test-plans-quality.mdMarkdown, rendered
Azure Test Plans - Testing & Quality Management
Azure Test Plans provides test management, test execution, and quality tracking for manual and automated testing scenarios.
Test Plans
Manage test plan organization and structure.
List Test Plans
GET /{organization}/{project}/_apis/testplan/plans?api-version=7.1
Query options:
?$orderBy=name- Sort by name?$top=50- Limit results?filterActivePlans=true- Active plans only
Get Test Plan
GET /{organization}/{project}/_apis/testplan/plans/{planId}?api-version=7.1
Create Test Plan
POST /{organization}/{project}/_apis/testplan/plans?api-version=7.1
Content-Type: application/json
{
"name": "Website Regression Testing",
"description": "Test plan for website functionality",
"startDate": "2025-01-15T00:00:00Z",
"endDate": "2025-01-31T23:59:59Z"
}
Update Test Plan
PATCH /{organization}/{project}/_apis/testplan/plans/{planId}?api-version=7.1
Content-Type: application/json
{
"name": "Updated Plan Name",
"description": "Updated description",
"state": "Active"
}
Test Suites
Organize tests into logical suites within plans.
List Test Suites
GET /{organization}/{project}/_apis/testplan/plans/{planId}/suites?api-version=7.1
Get Test Suite
GET /{organization}/{project}/_apis/testplan/plans/{planId}/suites/{suiteId}?api-version=7.1
Create Test Suite
POST /{organization}/{project}/_apis/testplan/plans/{planId}/suites?api-version=7.1
Content-Type: application/json
{
"name": "Login Functionality",
"suiteType": "StaticTestSuite",
"parentSuite": {
"id": "{parentSuiteId}"
}
}
Suite types:
StaticTestSuite- Manual suiteDynamicTestSuite- Query-based suiteRequirementTestSuite- Linked to requirements
Update Test Suite
PATCH /{organization}/{project}/_apis/testplan/plans/{planId}/suites/{suiteId}?api-version=7.1
Content-Type: application/json
{
"name": "Updated Suite Name",
"inheritDefaultConfigurations": true
}
Test Cases
Add and manage test cases within suites.
List Test Cases in Suite
GET /{organization}/{project}/_apis/testplan/plans/{planId}/suites/{suiteId}/testcases?api-version=7.1
Get Test Case
GET /{organization}/{project}/_apis/testplan/plans/{planId}/suites/{suiteId}/testcases/{testCaseId}?api-version=7.1
Add Test Case to Suite
POST /{organization}/{project}/_apis/testplan/plans/{planId}/suites/{suiteId}/testcases?api-version=7.1
Content-Type: application/json
{
"workItem": {
"id": "{workItemId}"
}
}
Create Test Case (as Work Item)
Test cases are work items of type "Test Case":
POST /{organization}/{project}/_apis/wit/workitems/$TestCase?api-version=7.1
Content-Type: application/json-patch+json
[
{
"op": "add",
"path": "/fields/System.Title",
"value": "Test user login with SSO"
},
{
"op": "add",
"path": "/fields/System.Description",
"value": "Verify user can log in using single sign-on"
},
{
"op": "add",
"path": "/fields/Microsoft.VSTS.TCM.Steps",
"value": "<steps id='0' last='2'><step id='1' type='ActionStep'><parameterizedString isformatted='true'>1. Navigate to login page</parameterizedString><parameterizedString isformatted='true'>SSO login option displayed</parameterizedString></step><step id='2' type='ActionStep'><parameterizedString isformatted='true'>2. Click SSO button</parameterizedString><parameterizedString isformatted='true'>User logged in successfully</parameterizedString></step></steps>"
}
]
Test Runs & Results
Manage test execution and result tracking.
Create Test Run
POST /{organization}/{project}/_apis/test/runs?api-version=7.1
Content-Type: application/json
{
"name": "Smoke Test Run",
"automated": false,
"build": {
"id": "{buildId}"
},
"releaseUri": "vstfs:///ReleaseManagement/Release/1",
"releaseEnvironmentUri": "vstfs:///ReleaseManagement/Release/1/environments/1",
"startedDate": "2025-01-15T10:00:00Z",
"completeDate": "2025-01-15T11:00:00Z",
"dueDate": "2025-01-15T12:00:00Z",
"state": "InProgress",
"planId": "{planId}",
"isAutomated": false
}
Get Test Runs
GET /{organization}/{project}/_apis/test/runs?api-version=7.1
Filter options:
?buildIds={buildId}- By build?automated=true- Automated tests only?$top=100- Limit results
Get Specific Test Run
GET /{organization}/{project}/_apis/test/runs/{runId}?api-version=7.1
Update Test Run
PATCH /{organization}/{project}/_apis/test/runs/{runId}?api-version=7.1
Content-Type: application/json
{
"state": "Completed",
"completeDate": "2025-01-15T11:30:00Z"
}
Test run states:
NotStarted- Created but not startedInProgress- Currently runningCompleted- FinishedAborted- Stopped before completionNotRelevant- Not applicable
Get Test Results
GET /{organization}/{project}/_apis/test/runs/{runId}/results?api-version=7.1
Get Specific Test Result
GET /{organization}/{project}/_apis/test/runs/{runId}/results/{resultId}?api-version=7.1
Add Test Results
POST /{organization}/{project}/_apis/test/runs/{runId}/results?api-version=7.1
Content-Type: application/json
[
{
"testCase": {
"id": "{testCaseId}"
},
"outcome": "Passed",
"startedDate": "2025-01-15T10:00:00Z",
"completedDate": "2025-01-15T10:05:00Z",
"durationInMs": 300000,
"comment": "Test executed successfully"
}
]
Update Test Results
PATCH /{organization}/{project}/_apis/test/runs/{runId}/results?api-version=7.1
Content-Type: application/json
[
{
"id": {resultId},
"outcome": "Failed",
"comment": "Assertion failed on line 45",
"errorMessage": "Expected value was not found"
}
]
Test outcomes:
Passed- Test passedFailed- Test failedNotExecuted- Test not runBlocked- Test blockedNotApplicable- Not applicablePaused- PausedInProgress- Currently executing
Test Configurations
Manage test configurations (browser, OS, device combinations).
List Configurations
GET /{organization}/{project}/_apis/testplan/configurations?api-version=7.1
Get Configuration
GET /{organization}/{project}/_apis/testplan/configurations/{configurationId}?api-version=7.1
Create Configuration
POST /{organization}/{project}/_apis/testplan/configurations?api-version=7.1
Content-Type: application/json
{
"name": "Chrome on Windows 10",
"description": "Configuration for Chrome browser on Windows 10",
"values": [
{
"configurationVariableId": "{varId1}",
"value": "Chrome"
},
{
"configurationVariableId": "{varId2}",
"value": "Windows 10"
}
]
}
Query Test Results
Analyze test execution history and trends.
Get Test Summary
GET /{organization}/{project}/_apis/test/runs/{runId}/statistics?api-version=7.1
Response includes:
- Total tests
- Passed count
- Failed count
- Not executed count
Get Test Trend
Query results over time:
GET /{organization}/{project}/_apis/test/ResultTrendService/QueryResultTrendForBuild?buildId={buildId}&api-version=7.1-preview
Best Practices
Test Planning
- Create comprehensive test plans before development
- Organize tests logically in suites
- Link tests to work items/requirements
- Define clear pass/fail criteria
- Document test steps explicitly
- Use configurations for cross-platform testing
- Keep test data up-to-date
Test Case Design
- Write clear, concise test names
- Break tests into logical steps
- Include expected results for each step
- Test one thing per test case
- Avoid test interdependencies
- Use parameterized tests for variations
- Link to requirements/user stories
Test Execution
- Run tests on every build
- Prioritize critical path testing
- Use configurations for browsers/OS
- Capture failure details
- Include environment information
- Log execution time for performance tracking
- Archive results for compliance
Defect Tracking
- Link failed tests to bugs
- Include reproduction steps
- Attach screenshots/logs
- Document environment details
- Assign defect priority
- Track defect resolution
- Prevent regression with tests
Continuous Integration
- Run automated tests in pipeline
- Fail build on test failures
- Track test coverage trends
- Run tests in parallel
- Cache test data
- Clean up test runs regularly
- Generate test reports
Reporting & Metrics
- Track pass/fail rates
- Monitor test coverage
- Measure bug escape rate
- Track defect density
- Calculate test effectiveness
- Monitor execution time trends
- Share metrics with stakeholders