【问题标题】:Get all the test run details executed against test plan id获取针对测试计划 ID 执行的所有测试运行详细信息
【发布时间】:2016-01-02 18:59:48
【问题描述】:

有没有办法让我根据测试计划 ID 执行测试运行 以编程方式?我还想获得过去 30 天或过去 X 天的结果?

为了获得特定测试运行的测试用例结果,我使用以下查询, var results = proj.TestResults.Query(string.Format("SELECT * FROM TestResult WHERE TestRunId =" + testRunId + ""));

【问题讨论】:

    标签: tfs tfs-sdk mtm


    【解决方案1】:

    要根据测试计划 ID 进行测试:

    TfsTeamProjectCollection tfctc = new TfsTeamProjectCollection(new Uri("http://tfsservername:8080/tfs/DefaultCollection"));
            ITestManagementService testmanagementService = tfctc.GetService<ITestManagementService>();
            var teamproject = testmanagementService.GetTeamProject("teamprojectname");
            var testruns = testmanagementService.QueryTestRuns("select * From TestRun");
            List<ITestRun> testrunInPlan = new List<ITestRun>(); 
            foreach (var testrun in testruns)
            {
                if (testrun.TestPlanId==31) // in this case TestPlanId is 31
                {
                    testrunInPlan.Add(testrun);
                }
            }
    

    获取特定测试运行的测试用例结果:

    ITestCaseResultCollection testcases = testrun.QueryResults();
    
                foreach (ITestCaseResult testcase in testcases)
                {
                    Console.WriteLine("TestCase ID: " + testcase.TestCaseId);
                    Console.WriteLine("TestCase Title: " + testcase.TestCaseTitle);
                    Console.WriteLine("Error Message: " + testcase.ErrorMessage);
                }
    

    有关测试管理 API 的详细信息,请查看此博客:http://blogs.msdn.com/b/aseemb/archive/2012/08/07/code-snippets-on-test-management-apis.aspx

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-01
      • 1970-01-01
      • 2020-09-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多