tfs-sdk – 使用TFS api显示测试结果表测试套件
发布时间:2020-12-14 02:03:58 所属栏目:Windows 来源:网络整理
导读:我正在与一个学校项目合作,我将分析公司缺陷数据库. 他们正在使用Microsoft Foundation Server(TFS). 我是TFS和TFS api的新手. 我在使用TFS客户端对象模型从TFS获取正确的数据时遇到了一些问题 . 我可以检索所有测试计划,它们各自的测试套件以及特定测试套件
我正在与一个学校项目合作,我将分析公司缺陷数据库.
他们正在使用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 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- group-policy – 如何在Windows 2012中更改默认区域/区域性
- 缓存 – 如何在Windows Phone 8上清除Cordova Web View的缓
- reactjs – 用酶测试Window Scroll事件处理程序的最佳方法是
- 七牛云关联Windows图床
- 我可以在Windows上运行Mac模拟器或Objective-C环境吗?
- windows-10-universal – WPF XAML在UWP边缘问题中旋转90°
- 无法在win32项目中包含ntifs.h
- windows-phone-7 – 如何禁用Windows Phone 7中列表框项目中
- [Windows Phone 8]如何绘制矩形?
- Windows 2008从不以“管理员”身份运行程序
推荐文章
站长推荐
热点阅读