I am trying to run automated tests using Cypress in Azure DevOps and publishing the tests results(Using PublishTestResult@2 Task) as an XML file using JUnit XML Reporter and merging them.
I am having trouble linking these published test results with the test cases in my ADO Test Plans, to my understanding JavaScript frameworks are currently not supported in Visual Studio to associate the tests with the test case ID, is there a workaround with this? Any help appreciated!
Tried using Visual Studio to associate the tests, publishing the results as an artifact to see if there was a way.
This question has come up before.
The short answer is it should be possible through automation.
The long answer is the test results that are produced from your build pipeline and the test results that are associated with a Test Plan are slightly different and you need a mechanism to map between them.
When looking at Test Plans in Azure DevOps, it's important to recognize:
You need a mapping between the Test Points and your automated tests.
How Automated Test Cases Work
How you can map your Test Results
The challenge with creating a universally supported approach outside of the .NET ecosystem is the reliable mapping of the test name in the JUnit/NUnit/xUnit test result to the Test Case. JavaScript, Java and Cucumber frameworks are horribly inconsistent and can vary per implementation, so it ultimately requires that you, the developer, are responsible for establishing that mapping. If you can produce that mapping, the rest is automation against the REST APIs:
There is an article that describes the above here.
One approach to provide the mapping of Test Case to test result, is to put the ID of the Test Case in the title of the test, eg <TestCase-ID>_<TestName>
.
Update 2024/01/30:
I have an Azure DevOps Extension that can perform the above. If you'd like to be added to the private-preview, please submit a request here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With