0

I need to update the test case execution status ("Pass" or "Fail") once the test case is executed. This needs to be done through pytest execution. I looked into a couple of resources but I don't get any way to update the Test Case execution status like "Pass" or "Fail" through API. Along with that, I can get the execution detail with Execution ID but there is no reference found using I can get execution details of a Test Case by Test Case ID.

Please guide me here.

1 Answer 1

1

For update test case result, try with this api:

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

For request body:

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

Modify the value of outcome into what you want--Failed or Pass

Sign up to request clarification or add additional context in comments.

3 Comments

@merlin-liang-msft that sounds good. But the problem is the execution performed in the pytest and test execution ID is generated there. Which runID it is asking in the URL params? In simple terms, I want to run a test case in the pytest once it is passed that its test case should have execution status passed. When calling through API it is asking for the runID which in the pytest execution. please help.
@SajjadSarwar So, now the problem is you could not get the runId of the test which executed in pytest?
@merlin-liang-msft Thanks for the help, I was able to achieve it via creating a Test Plan > Test Suit > Test Run > Test Execution > Updating the execution status under Test Runs and it worked perfectly through the API.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.