【问题标题】:How to get result history of specific testcase using tfs-sdk如何使用 tfs-sdk 获取特定测试用例的结果历史记录
【发布时间】:2013-05-07 18:19:03
【问题描述】:

我在测试管理器中有自动化测试用例。该测试用例在不同的构建中执行了多次(它位于多个测试运行中)。我可以通过测试管理器 UI(测试管理器 -> 分析测试运行 -> 打开测试运行 -> 查看测试用例的结果 -> 结果历史表)查看测试执行的历史记录。

如何使用 TFS API 获取相同的数据?

【问题讨论】:

    标签: tfs-sdk microsoft-test-manager


    【解决方案1】:

    我会这样做:

    using Microsoft.TeamFoundation.Client;
    using Microsoft.TeamFoundation.TestManagement.Client;
    
    var tfsCollection = new TfsTeamProjectCollection(
                    new Uri(@"http://<yourTFS>:8080/tfs/<your collection>"),
                    new System.Net.NetworkCredential(<user who can access to TFS>,<password>));
    tfsCollection.EnsureAuthenticated();
    
    ITestManagementService testManagementService = tfsCollection.GetService<ITestManagementService>();
    
    var testRuns = testManagementService.QueryTestRuns("SELECT * FROM TestRun WHERE TestRun.TestPlanId=<your test plan ID>");
    
    IEnumerable<ITestCaseResult> testResultHistoryYouWant = from testRun in testRuns
                                    from testResult in testRun.QueryResults()
                                    where testResult.TestCaseId == <your test case ID>
                                    select testResult;
    

    【讨论】:

    猜你喜欢
    • 2018-12-10
    • 1970-01-01
    • 2018-11-09
    • 1970-01-01
    • 1970-01-01
    • 2019-08-23
    • 1970-01-01
    • 2013-04-02
    • 1970-01-01
    相关资源
    最近更新 更多