Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/tfs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
TFS API-按自定义字段搜索测试用例”;扩展ID“;,在特定层次结构中,然后更新其结果_Tfs_Tfs Sdk_Microsoft Test Manager - Fatal编程技术网

TFS API-按自定义字段搜索测试用例”;扩展ID“;,在特定层次结构中,然后更新其结果

TFS API-按自定义字段搜索测试用例”;扩展ID“;,在特定层次结构中,然后更新其结果,tfs,tfs-sdk,microsoft-test-manager,Tfs,Tfs Sdk,Microsoft Test Manager,我是TFSAPI新手。我环顾四周,但发现我的问题没有完全解决 我想做的是通过ID=104的测试计划中的自定义字段“Extended ID”=“EXT:123”和ID=1455的测试套件来搜索特定的测试用例。这个问题可能有两个部分 1) TestSuiteID在项目的整个测试计划中是唯一的吗?如果没有,那么我必须通过挖掘层次结构“Project”-->“TestPlan”-->“TestSuite”来搜索特定的测试套件。我该怎么做 2) 有人能告诉我如何在特定的测试套件中通过自定义字段“Exten

我是TFSAPI新手。我环顾四周,但发现我的问题没有完全解决

我想做的是通过ID=104的测试计划中的自定义字段“Extended ID”=“EXT:123”和ID=1455的测试套件来搜索特定的测试用例。这个问题可能有两个部分

1) TestSuiteID在项目的整个测试计划中是唯一的吗?如果没有,那么我必须通过挖掘层次结构“Project”-->“TestPlan”-->“TestSuite”来搜索特定的测试套件。我该怎么做

2) 有人能告诉我如何在特定的测试套件中通过自定义字段“Extended ID”=“EXT:123”搜索特定的测试用例吗

到目前为止,我已经

        string tfsUrl = "http://tfs:8080/tfs/DefaultCollection";
        string projectName = "MyProduct";
        int testPlanId = 111;
        int testsuiteId = 2222;
        int extendedId = "EXT:123";

        ITestManagementTeamProject proj = GetProject(tfsUrl, projectName);

        var tps = proj.TestPlans;
        var tp = tps.Find(testPlanId);
        // How do I find a Test Suite within a Test Plan? 

        // Searching for a Test Suite ID within a project works only if its unique throughout all test plans within the project
        var tss = proj.TestSuites;
        var ts = tss.Find(testsuiteId); // This works 
        var tcs = ts.AllTestCases;

        foreach (var tc in tcs)
        {
            // I want to find a test case with custom field "Extended ID" that matches "EXT:123"
            if (tc.??????? == extendedId) 
            {                    
                var testResults = proj.TestResults.ByTestId(tc.Id);
                // How do I update its test result?
提前谢谢

tc.CustomFields[“扩展ID”]。 此外,测试结果与测试运行中的测试点(测试用例和配置的组合)相关联。一个测试用例可能有多个测试结果。您需要知道并指定要更新的结果