用于测试用例参数值的 Azure DevOps REST API
Azure DevOps REST API for Test Case Parameters Values
我正在尝试使用 REST API 调用测试用例参数值。 DevOps 是否有 REST API 来调用测试用例参数?
我只找到了如何调用测试用例:
GET https://{instance}/{collection}/{project}/_apis/test/Plans/{planId}/suites/{suiteId}/testcases/{testCaseIds}?api-version=5.0
测试用例是工作项类型,所以可以使用Get Work Item Rest API获取参数:
GET https://{instance}/{collection}/{project}/_apis/wit/workitems/{id}?api-version=5.0
在响应中,您将在 fields
部分获得此内容:
Microsoft.VSTS.TCM.Parameters: "<parameters><param name='test'><value>Shayki</value></param></parameters>"
直接获取参数的方法是在URL中添加fields=Microsoft.VSTS.TCM.LocalDataSource
。像这样:
GET https://{instance}/{collection}/{project}/_apis/wit/workitems/{id}?fields=Microsoft.VSTS.TCM.LocalDataSource&api-version=5.1
Resposne 会喜欢这个
XML格式:
<NewDataSet>
<xs:schema id='NewDataSet'
xmlns:xs='http://www.w3.org/2001/XMLSchema'
xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
<xs:element name='NewDataSet' msdata:IsDataSet='true' msdata:Locale=''>
<xs:complexType>
<xs:choice minOccurs='0' maxOccurs = 'unbounded'>
<xs:element name='Table1'>
<xs:complexType>
<xs:sequence>
<xs:element name='Language' type='xs:string' minOccurs='0' />
<xs:element name='ItemNo' type='xs:string' minOccurs='0' />
<xs:element name='Item' type='xs:string' minOccurs='0' />
xs:element name='User' type='xs:string' minOccurs='0' />
<xs:element name='Password' type='xs:string' minOccurs='0' />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<Table1>
<Language>EN</Language>
<ItemNo>1234</ItemNo>
<Item>Item1</Item>
<User>User1</User>
<Password>Pass1</Password>
</Table1>
</NewDataSet>
我正在尝试使用 REST API 调用测试用例参数值。 DevOps 是否有 REST API 来调用测试用例参数?
我只找到了如何调用测试用例:
GET https://{instance}/{collection}/{project}/_apis/test/Plans/{planId}/suites/{suiteId}/testcases/{testCaseIds}?api-version=5.0
测试用例是工作项类型,所以可以使用Get Work Item Rest API获取参数:
GET https://{instance}/{collection}/{project}/_apis/wit/workitems/{id}?api-version=5.0
在响应中,您将在 fields
部分获得此内容:
Microsoft.VSTS.TCM.Parameters: "<parameters><param name='test'><value>Shayki</value></param></parameters>"
直接获取参数的方法是在URL中添加fields=Microsoft.VSTS.TCM.LocalDataSource
。像这样:
GET https://{instance}/{collection}/{project}/_apis/wit/workitems/{id}?fields=Microsoft.VSTS.TCM.LocalDataSource&api-version=5.1
Resposne 会喜欢这个
XML格式:
<NewDataSet>
<xs:schema id='NewDataSet'
xmlns:xs='http://www.w3.org/2001/XMLSchema'
xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
<xs:element name='NewDataSet' msdata:IsDataSet='true' msdata:Locale=''>
<xs:complexType>
<xs:choice minOccurs='0' maxOccurs = 'unbounded'>
<xs:element name='Table1'>
<xs:complexType>
<xs:sequence>
<xs:element name='Language' type='xs:string' minOccurs='0' />
<xs:element name='ItemNo' type='xs:string' minOccurs='0' />
<xs:element name='Item' type='xs:string' minOccurs='0' />
xs:element name='User' type='xs:string' minOccurs='0' />
<xs:element name='Password' type='xs:string' minOccurs='0' />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<Table1>
<Language>EN</Language>
<ItemNo>1234</ItemNo>
<Item>Item1</Item>
<User>User1</User>
<Password>Pass1</Password>
</Table1>
</NewDataSet>