WIQL (Work Item Query Language) is the query language for Work Items that Test Management adopts for querying test objects. In Microsoft Test Manager (MTM), WIQL queries are hidden away from users and only the query results are displayed. Nevertheless, if you ever need to use the command-line tool (TCM.exe) or to write your own code against the TCM OM, knowing the Test-specific WIQL syntaxes would become very handy.
General information about WIQL can be read from MSDN. In this post, I will discuss what you need to know when using WIQL with Test Management. If you have used WIQL before with Work Item Tracking(WIT) OM, you will find several discrepancies between the WIT and TCM WIQL queries. This is because we implemented a simplified model of the WIQL engine that suites our needs in this version.
Here is the list of differences and Test-specific information:
What you will also want to know are the table names and the list of field names that you can use to construct your query. Here is the rule of thumb:
"In general, the table names will match the interface name minus the ‘I’ (e.g. ITestResult –> TestResult). The field names will match the names of the corresponding properties of the object (e.g. ITestConfiguration.Name –> Name).”
The table below lists all tables and supported fields for Test-specific WIQL queries*.
Table
Fields
Notes
TestAttachment
AttachmentId
AttachmentType
FileName
IsComplete
IterationId
TestResultId
TestRunId
TmiRunId
TestConfiguration
AreaPath
Description
Id
IsDefault
LastUpdated
LastUpdatedBy
Name
Revision
State
TeamProject
TestPlan
AutomatedTestEnvironmentId
EndDate
Iteration
ManualTestEnvironmentId
Owner
PlanAutomatedTestSettingsId
PlanId
PlanLastUpdated
PlanLastUpdatedBy
PlanName
PlanRevision
PlanState
PlanTestSettingsId
StartDate
TestPoint
AssignedTo
Comment
ConfigurationId
FailureType
LastResolutionStateId
LastResultOutcome
LastResultState
LastTestResultId
LastTestRunId
PointId
PointLastUpdated
PointLastUpdatedBy
PointRevision
PointState
RecursiveSuiteId*
SuiteId
SuiteState
TestCaseId
* RecursiveSuiteId is used to query all test points that appear in the given suite and any suite contained in the given suite. If both RecursiveSuiteId and SuiteId are provided, the query will use the RecursiveSuiteId.
TestResult
AutomatedTestId*
AutomatedTestName*
AutomatedTestStorage*
AutomatedTestType*
AutomatedTestTypeId*
ComputerName
CreationDate
DateComplete
DateStarted
Duration
ErrorMessage
Outcome
Priority
ResetCount
ResolutionStateId
TestCaseArea
TestCaseRevision
TestCaseTitle
TestPlanId
TestPointId
* The Automated Test information is stored in the ITestCaseResult .Implementation property. These properties come from ITmiTestImplementation, which derives from ITestImplementation.
TestRun
BuildConfigurationId
BuildFlavor
BuildNumber
BuildPlatform
BuildUri
CompleteDate
Controller
DropLocation
DueDate
IsAutomated
IsBvt
LegacySharePath*
PostProcessState
PublicTestSettingsId
TestEnvironmentId
TestMessageLogId
Title
Type
Version
* Not exposed in ITestRun
TestSettings
CreatedBy
CreatedDate
IsPublic*
* Not exposed in ITestSettings
TestSuite
ParentId
ProjectName
Query*
RequirementId**
SuiteType
* Part of the IDynamicTestSuite** Part of the IRequirementTestSuite
* Many thanks to Peter Van Nuys for gathering the information in this table.