yog*_*m78 2 c# qc hp-quality-center
我在C#中使用OTA API.
如果我有测试用例ID,如何在QC中找到测试.(按测试用例ID查找测试)测试可能出现在测试计划中的任何文件夹下(即在SUbject下).
假设您具有开放连接并且知道存在该ID的测试(例如,来自先前查询的结果),您可以执行以下操作:
int testId = 1234;
TestFactory tf = connection.TestFactory;
Test t = tf[id];
Run Code Online (Sandbox Code Playgroud)
对TestFactory索引器的调用将引发一个COMException,其中"Item not exists".如果具有该ID的测试不存在.
如果您不确定是否存在具有该ID的测试,则可以执行以下操作:
int testId = 1234;
TestFactory tf = connection.TestFactory;
TDFilter filter = tf.Filter;
filter["TS_TEST_ID"] = id.ToString();
List tests = tf.NewList(filter.Text); // List collection is the ALM List, not .NET BCL List.
Test t = (tests.Count > 0) ? tests[1] : null; // ALM List collection indexes are 1-based, and test ID is guaranteed to be unique and only return 1 result if it exists.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10736 次 |
| 最近记录: |