This is a skill for test management in Azure Test Plans.
Main Features
- Test Case Creation: Manual and automated tests
- Test suite: Grouping
- Test Execution: Result recording
- Bug Reporting: Create bugs from test failures
Test Case Creation
REST API (Python)
import requests
import json
organization = "myorg" project = "MyProject" pat = "your-pat"
url = f"https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/$Test Case?api-version=7.0"
headers = { "Content-Type": "application/json-patch+json", "Authorization": f"Basic {pat}" }
test_case = [ { "op": "add", "path": "/fields/System.Title", "value": "Login function test" }, { "op": "add", "path": "/fields/Microsoft.VSTS.TCM.Steps", "value": "1. Open the login pageThe login form is displayed2. Enter email address and password3. Click the login buttonRedirected to the dashboard" }, { "op": "add", "path": "/fields/Microsoft.VSTS.TCM.AutomatedTestName", "value": "LoginTests.TestSuccessfulLogin" } ]
response = requests.post(url, headers=headers, data=json.dumps(test_case)) print(response.json())
## テストスイート作成
```bash
# テストプラン作成
az boards test-plan create \
--name "Sprint 1 Tests" \
--area-path "MyProject" \
--iteration "MyProject\\Sprint 1"
# テストスイート作成
az boards test-suite create \
--plan-id 1 \
--name "Login Tests" \
--suite-type "StaticTestSuite"
Automated Test Integration
# Azure Pipeline with Test Results
steps:
- task: VSTest@2
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: |
**\*test*.dll
!**\*TestAdapter.dll
!**\obj\**
searchFolder: '$(System.DefaultWorkingDirectory)'
codeCoverageEnabled: true
testRunTitle: 'Automated Tests'
publishRunAttachments: true
Version Information
- Version: 1.0.0