0

We are automating Windows based Application using UFT and Client requires us to integrate UFT with VSTS since Functional testing Team is using VSTS Dashboard for all Testing Life Cycle. Please help me in this regard if anyone has implemented this stuff earlier or currently working on same. Regards Raman Kumar

Rodger Nadal
  • 309
  • 2
  • 8
  • 21
  • Check these links http://stackoverflow.com/questions/37339104/uft-12-02-qtp-integration-with-tfs and https://visualstudio.uservoice.com/forums/330519-team-services/suggestions/3251899-integration-between-qtp-team-foundation-server-t – starian chen-MSFT May 12 '17 at 02:27
  • Thanks @starain-MSFT for sharing the links.. It looks like the links are related to UFT and TFS Integration. Whereas, My Concern is UFT-VSTS Integration. We need to run our scripts in UFT and then publish the results back in VSTS. – Rodger Nadal May 15 '17 at 10:27
  • Do you want to do it during the VSTS build? If so, you can run test in UFT through command line (e.g. PowerShell), then publish test result to TFS through publish test result step (https://www.visualstudio.com/en-us/docs/build/steps/test/publish-test-results). If you want to associate test result to a test case, you can publish test result through TCM tool (https://msdn.microsoft.com/en-us/library/ff942469.aspx?f=255&MSPPError=-2147217396) – starian chen-MSFT May 16 '17 at 01:35
  • starain-MSFT Here is my Client Requirement:- 1. Run the UFT Scripts through Jenkins CI Build. 2. Capture each and every result and execution logs in Jenkins. 3. Integrate Jenkins with VSTS(Not TFS) so that Project Team can see the Execution Logs and Reports in VSTS. As Our Manual Testing Team is already using VSTS or Sandpit for test Life Cycle. They raise their bugs there and everything is there itself. – Rodger Nadal May 17 '17 at 09:57

1 Answers1

0

Refer to these steps:

  1. Run UFT scripts through Jenkins build
  2. Call VSTS REST API to create new test run and update test result with a specified bug.

Create new test run

Update test results for a test run

You can call REST API by using Microsoft Team Foundation Server Extended Client.

Simple code:

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;
starian chen-MSFT
  • 33,174
  • 2
  • 29
  • 53
  • I still not able to resolve Upload Test Results for a Test Run, I have gone through the above Link for "Update test results for a test run" I am not able to understand. Do I need to create any API or can use inbuilt API for same, can you please share any step-by-step Document for same. – Rodger Nadal Aug 08 '17 at 09:02
  • That is REST API that call through HTTP request. You can call that REST API programming, such as I said that through the code that I provided. – starian chen-MSFT Aug 08 '17 at 09:29