testfx: Incorrect test result view in Azure DevOps after upgrading MSTest to 2.2.4 and higher
Description
After I updated MSTest.Framework and MSTest.Adapter to 2.2.4 and higher, the test results in Azure DevOps are displayed incorrectly. Each test interation is displayed in a new line. Before that, the interations were shown under a test case.
For example: A Test with 2 iterations
Before: TestCase12
- Iteration1
- Iteration2
Currently
- TestCase12
- TestCase12
This a screenshot for the test results on Azure DevOps
For example: Test Case 1129
TRX-File look like different
After the upgrade, the trx file does not contain an <InnerResults>
element
Hier is a screenshot fom trx-file
I use VS 2019 16.11.6 I’m not sure if this is a bug or a new configuration. This is my test configuration: Configure unit tests by using a .runsettings file
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 72 (23 by maintainers)
Duly noted. Believe me, I am not happy about this either. We are looking into conditionally reverting this change until it is fixed in azdo.
This is not a bug, mstest now reports data driven tests as single tests. This was done to bring parity to how xunit and nunit does it.
@Haplois There are few duplicates of this issue. Could you link them all to a single one, and post an update on when the work on AzDO will be finished, please?
Also correct my statement above if I am wrong 😃
@nohwnd
The ONLY reason I and many other engineers use MSTest is because of the seamless integration with Azure DevOps Test Hub. If you cannot maintain this integration you are just undermining the project.
Here are my concerns:
As far as I can tell here are the related/duplicate issues:
I forgot to mention that the link you posted above (link) seems to go to an MS internal ADO. Do you have any public information on that issue?
P.S. It also could be that our TFS server is just not configured correctly. I would guess that its configuration has not been revisited since ~2015. It seems like it just doesn’t deliver the source code developed in VS 2022 to the Azure DevOps agent correctly. The easy solution is to move to GitHub. Will try to help the team do it.
Update 11/12/22: I was able to create a completely new folder (not a new repo, but a new folder) in our TFS repo, upload the 2022 version of my test solution with the latest adapters and latest test agent as shown above, and I got good results, with the correct number of test cases displayed in Azure DevOps. This means the older TFS will work as a sources repository, I just had to use a fresh folder. It must have been that there was something being retained in the older folder which contained the VS 2015 version of the test solution. For others still getting errors, I would recommend the same approach: try your old source repository but use a fresh folder and make sure you convert your solution to the latest Visual Studio and the latest adapters.
Just want to mention I am working on making sure I am giving you the correct information. We have some very legacy elements in our system, including the fact that our ADO is hooked up to a Team Foundation server as the source repository. I am making some changes to ensure that I am giving you the right info.
Hey there. Thanks for bearing with us. We did more investigation with @dogirala and here are the results.
Code example
When running the tests for the following code:
MSTest up to
2.2.3
(included)Result file (.trx)
The test result file (
.trx
) would look like this:What’s important to note is:
InnerResults
of the test method (they have the same test ID)TestDefinitions
only contains 2 entriesAzure DevOps
Azure DevOps is parsing the trx file and using the results to populate their UI. For the previous trx file, display will be:
2/2
reported for the number of tests because they are reading theTestDefinitions
entries of the trx.DataRowTestMethod (0)
,DataRowTestMethod (1)
,DataRowTestMethod (2)
) grouped under the one item namedDataRowTestMethod
because they are using the grouping provided inUnitTestResult
of the trx.TestMethod1
MSTest from
2.2.4
(included)Result file (.trx)
The test result file (
.trx
) would look like this:What’s important to note is:
TestDefinitions
contains 4 entriesAzure DevOps
Azure DevOps is parsing the trx file and using the results to populate their UI. For the previous trx file, display will be:
4/4
reported for the number of tests because they are reading theTestDefinitions
entries of the trx.DataRowTestMethod (0)
,DataRowTestMethod (1)
,DataRowTestMethod (2)
) at the same indent level asTestMethod1
.Reasoning for the change in 2.2.4
This change was done to overcome some issues on MSTest (e.g. if datarows are displayed as children they cannot have a different test ID and so are not expanded in Visual Studio - leading to impossibility to run/debug only 1 case) and also to have a better parity with results of
NUnit
andxUnit
test frameworks.What’s next
I am going to start a discussion with AzDo team to improve the UX by allowing some grouping by test while keeping the test count, test filter and other functionalities working properly.
Hey there! Sorry the messages weren’t super clear.
The issue raised in this ticket wasn’t linked to a problem in MSTest per say but it was linked to some change of behavior in MSTest (it should not have been done in a patch version) that wasn’t reflected on AzDo side. AzDo team updated the behavior on their side and we were waiting for it to be deployed (according to @dogirala it was done 2 days ago).
Regarding on-prem instances, @dogirala could you please let us know what’s the process?
@charlesdwmorrison Could you confirm that you are using non on-prem AzDo?
I will make some more manual tests to confirm issue is correctly fixed and will post my results here. In the meantime, I will reopen the ticket.
The fix is deployed now. All deployments are completed
@Evangelink , @charlesdwmorrison I see the fix has been deployed but somehow it didn’t reflect in microsoft which is strange. For microsoft org I still see old PTR task version which is 2.203.0, ideally it should be 2.210.0. I am checking with my team and concerned deployments team. Will let you know as soon as I find out something on this.
Other ex pipeline:
