我们正在使用UFT自动化基于Windows的应用程序,客户要求我们将UFT与VSTS集成,因为功能测试团队正在使用VSTS仪表板进行所有测试生命周期。 如果有人早先实现了这些东西或目前正在进行相同的工作,请在这方面帮助我。 问候 拉曼库马尔
答案 0 :(得分:0)
请参阅以下步骤:
Update test results for a test run
您可以使用Microsoft Team Foundation Server Extended Client调用REST API。
简单代码:
var u = new Uri("https://[account].visualstudio.com");
VssCredentials c = new VssCredentials(new Microsoft.VisualStudio.Services.Common.VssBasicCredential(string.Empty, "[personal access token]"));
var connection = new VssConnection(u, c);
var testClient = connection.GetClient<TestManagementHttpClient>();
int testpointid = 158;
string teamProject = "scrum2015";
RunCreateModel run = new RunCreateModel(name:"APIRun7",plan:new Microsoft.TeamFoundation.TestManagement.WebApi.ShallowReference("232"),pointIds:new int[] { testpointid });
TestRun testrun = testClient.CreateTestRunAsync(teamProject, run).Result;
TestCaseResultUpdateModel testCaseUpdate = new TestCaseResultUpdateModel() { State="Completed", Outcome="Passed", TestResult=new Microsoft.TeamFoundation.TestManagement.WebApi.ShallowReference("100000") };
var testResults = testClient.UpdateTestResultsAsync(new TestCaseResultUpdateModel[] { testCaseUpdate }, teamProject, testrun.Id).Result;
RunUpdateModel runmodel = new RunUpdateModel(state: "Completed");
TestRun testRunResult= testClient.UpdateTestRunAsync(teamProject, testrun.Id, runmodel).Result;