使用Rest API将VSTS测试用例状态更新为PASS/FAIL [英] Update VSTS test case status to PASS / FAIL using rest api

查看:49
本文介绍了使用Rest API将VSTS测试用例状态更新为PASS/FAIL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用rest api更新VSTS中的测试用例状态.

基于测试用例ID,我想将测试用例更新为PASS或FAIL.

我可以在哪个传递状态的状态下使用哪个REST API?

谢谢

解决方案

您可以为一个特定的测试用例更新最后的测试结果,然后结果将反映在测试用例.

  1. 首先获取最后的测试运行ID.(使用REST API用户-

    I want to update a test cases status in VSTS using rest api.

    Based on test case Id I want update the testcase to PASS or FAIL.

    Which rest api can be used from where I can pass status?

    Thank you

    解决方案

    You can update the last test result for a sepcific test case, then the outcome will reflect on the test case.

    1. Get the last test run ID first. (User the REST API - Get a list of test runs)
    2. Use the REST API to update the specific test result.

      PATCH https://dev.azure.com/{organization}/{project}/_apis/test/Runs/{runId}/results?api-version=5.0-preview.5
      

      Request Body

      [
        {  
          "id": 100000,
          "state": "Completed",
          "outcome": "Passed"
        }
      ]
      

    Please see Update test results for a test run for details.

    You can reference this similar thread : Changing the outcome field of testcases within a test suite in Tfs


    UPDATE:

    If you just want to mark a test case to Passed or Failed and generate a RUNID, then you can use below REST API: (Provide the PlanID, suite ID and test point ID in the request body)

    POST http://SERVER:8080/tfs/DefaultCollection/{ProjectName or ID}/_api/_testManagement/BulkMarkTestPoints
    
    Content-Type : application/json
    
    Request Body:
    
    {"planId":36,"suiteId":38,"testPointIds":[5],"outcome":3}
    

    1. You can get the Plan Id, Suite Id from web portal (Reference below screenshot)
    2. You can use below REST API to get the testPointIds:

      GET http://SERVER:8080/tfs/DefaultCollection/{ProjectName or ID}/_apis/test/Plans/36/Suites/38/points
      

    3. For outcome: 2 means Passed, 3 means Failed

    这篇关于使用Rest API将VSTS测试用例状态更新为PASS/FAIL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆