wordpress   发布时间:2022-04-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了tfs-sdk – 使用TFS api显示测试结果表测试套件大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

我正在与一个学校项目合作,我将分析公司缺陷数据库. 他们正在使用Microsoft Foundation Server(TFS). 我是TFS和TFS api的新手. 我在使用TFS客户端对象模型从TFS获取正确的数据时遇到了一些问题 . 我可以检索所有测试计划,它们各自的测试套件以及特定测试套件使用的每个测试用例,但是当我想在哪个测试套件中看到我从测试用例获得特定测试结果时,问题出现了.由于套件
@H_489_13@
我正在与一个学校项目合作,我将分析公司缺陷数据库.
他们正在使用Microsoft Foundation Server(TFS).
我是TFS和TFS api的新手.

我在使用TFS客户端对象模型从TFS获取正确的数据时遇到了一些问题
.
我可以检索所有测试计划,它们各自的测试套件以及特定测试套件使用的每个测试用例,但是当我想在哪个测试套件中看到我从测试用例获得特定测试结果时,问题出现了.由于套件中不止一个可以使用相同的测试用例,我无法看到结果来自哪个套件.

我这样做是从套件中获取测试用例:

foreach (ITestSuiteEntry TESTCase in suiteEntrys)
{
    Console.WriteLine("\t \t Test Case: {0}",TESTCase.title+","+"Test case priority: "+ TESTCase.TESTCase.Priority+"Test case Id: "+TESTCase.TESTCase.Id);
    //Console.Write(",Test Case: {0}",TESTCase.ToString());

    //get each test result:
    getTestResult(TESTCase,proj);
}

private void getTestResult(ITestSuiteEntry TESTCase,ITestManagementTeamProject proj)
{
    var testResults = proj.TestResults.byTestId(TESTCase.TESTCase.Id);
    foreach (ITESTCaseResult result in testResults)
    {
        Console.WriteLine("\t \t \t"+result.DateCreated+","+result.outcomE);
    }
}

所以我的问题是,如何才能看到用于执行测试的测试套件?

解决方法

看看下面的代码片段.
它向您展示了如何使用测试点ID获取特定测试套件的测试结果.
您可以使用类似的方法来实现您的目标.

var tfsCollection = new TfsTeamProjectCollection(
        new Uri(tfsUrl),new System.Net.NetworkCredential(<user>,<password>));
tfsCollection.EnsureAuthenticated();

var testManagementservice = tfsCollection.Getservice<ITestManagementservice>();
var teamProject = testManagementservice.GetTeamProject(projectName);
var testPlan = teamProject.TestPlans.Find(testPlanId);

// Get all Test Cases belonging to a particular Test Suite.
// (If you are using several Test Configurations and want to take only one of them into account,// you will have to add 'AND ConfigurationId = <your Test Configuration Id>' to the WHERE clause.)
String queryForTestPointsForSpecificTestSuite = String.Format("SELECT * FROM testPoint WHERE SuitEID = {0}",suitEID );
var testPoints = testPlan.QueryTestPoints(queryForTestPointsForSpecificTestSuitE);
// We are going to use these ids when analyzing Test Results
List<int> testPointsIds = (from testPoint in testPoints SELEct testPoint.Id).ToList();

var testResults = teamProject.TestResults.byTestId(TESTCasEID);

var testResultsForSpecificTestSuite = testResults.Where(testResult => testPointsIds.Contains(testResult.TestPointId));

博客文章将在创建查询时为您提供帮助:WIQL for Test

大佬总结

以上是大佬教程为你收集整理的tfs-sdk – 使用TFS api显示测试结果表测试套件全部内容,希望文章能够帮你解决tfs-sdk – 使用TFS api显示测试结果表测试套件所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。