testfx icon indicating copy to clipboard operation
testfx copied to clipboard

Incorrect test result view in Azure DevOps after upgrading MSTest to 2.2.4 and higher

Open mabadev opened this issue 2 years ago • 21 comments

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 image


TRX-File look like different After the upgrade, the trx file does not contain an <InnerResults> element

Hier is a screenshot fom trx-file image


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

mabadev avatar Dec 20 '21 15:12 mabadev

Hey, I think this issued I recently posted is related/same #1024

Legoldos avatar Jan 03 '22 05:01 Legoldos

Hey, I think this issued I recently posted is related/same #1024

I think the main problem is the same. thanks for that

mabadev avatar Jan 04 '22 21:01 mabadev

Any progress on this topic? We cannot upgrade from 2.2.3 to 2.2.8 until this is fixed :(

nixdagbibts avatar Mar 11 '22 23:03 nixdagbibts

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 avatar Mar 12 '22 07:03 nohwnd

@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:

  1. The team broke this integration a year ago and it has yet to be addressed
  2. The interesting (wrong) assertion that this is "not a bug"
  3. The trx report format has fundamentally changed and that doesn't seem to justify a major or minor version bump
  4. I know this project and the Azure DevOps Visual Studio Test task are separate projects, but this kind of thing has the stink of the bad old days of Microsoft. - AKA Microsoft cannot seem to even work with itself

As far as I can tell here are the related/duplicate issues:

  • https://github.com/microsoft/testfx/issues/860
  • https://github.com/microsoft/testfx/issues/955
  • https://github.com/microsoft/testfx/issues/992
  • https://github.com/microsoft/testfx/issues/1023
  • https://github.com/microsoft/testfx/issues/1026
  • https://github.com/microsoft/testfx/issues/1035

TroyWalshProf avatar Mar 14 '22 16:03 TroyWalshProf

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.

nohwnd avatar Mar 15 '22 12:03 nohwnd

@nohwnd - If I may make a suggestion: I would love to see splitting or consolidating tests being optional, much like parallelization. Maybe using an attribute such as "DataDrivenToSingleTest". This way users have the option of how they want to group such tests. *This would follow the same basic pattern as the "DoNotParallelize" attribute.

Example:

        [DataTestMethod]
        [DataDrivenToSingleTest] // Allow users to set this on the test, test class, and in the run settings file like you can for parallel
        [DataRow("ConfigJsonEnvRunOverride", "OVERRIDE")]
        [DataRow("OverrideOnly", "OVERRIDE")]

TroyWalshProf avatar Mar 15 '22 12:03 TroyWalshProf

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 :)

Hello @nohwnd Can you please provide link for some kind of documentation where this new behavior is explained? I couldnt find anything in MSTEST release notes. I would like something to grasp on when I explain this new behavior to my team.

Legoldos avatar Mar 15 '22 16:03 Legoldos

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.

Hoping to resolve this obstacle or to find an alternative solution for it. Our project has suffered because of that.

mabadev avatar Mar 24 '22 10:03 mabadev

Hello @nohwnd Can you please provide link for some kind of documentation where this new behavior is explained? I couldnt find anything in MSTEST release notes. I would like something to grasp on when I explain this new behavior to my team.

I would also like to know, as I did not find the related changes by glancing over 2.2.4's release notes and commits.

ChristoWolf avatar Apr 08 '22 07:04 ChristoWolf

Are there any updates to this as yet? also getting very frustrated and using work arounds is less than ideal

MonzT avatar Jun 08 '22 14:06 MonzT

@Haplois @Evangelink did you get any update from AzDo about the progress of the fix? I know we talked with them a while ago.

nohwnd avatar Aug 11 '22 08:08 nohwnd

@nohwnd We didn't get an update - I pinged them.

Haplois avatar Aug 11 '22 12:08 Haplois

They have a fix, and expect to ship it next sprint. I asked about exact date.

Haplois avatar Aug 11 '22 19:08 Haplois

@Haplois Thanks for the update.

Nidolai avatar Aug 15 '22 06:08 Nidolai

Getting the next sprint date would be great. As far as I can see, this change significantly breaks all test harnesses which are heavily Data Driven. I.e., test harness which have many rows in Excel, Access, or a Database. Teams following that methodology may have 100 test cases in one spreadsheet, with differ data rows of the spreadsheet testing different features, all going through one test method. While this is not ideal, a lot of teams/organizations perform testing. If one of these rows fails, the entire test fails? That does really skew the results.

Related well-reasoned posts on this issue include: https://developercommunity.visualstudio.com/t/vstest-test-publication-miscounts-test-cases-and-c/909375 https://developercommunity.visualstudio.com/t/tests-tab-on-build-results-page-shows-wrong-test-c/1385811

Looking forward to seeing what the fix is. If is necessary to bring MSTest.exe in line with NUnit and XUnit, there should be a command line flag to allow for backward compatibility with the old approach.

charlesdwmorrison avatar Aug 31 '22 19:08 charlesdwmorrison

I spoke with the product team again, the fix in release pipeline and will be deployed within this sprint (which will be ending on 12th of September). I couldn't get an exact date.

/cc @dogirala from the product team.

Haplois avatar Sep 01 '22 10:09 Haplois

So when will milestone 2.3.0 be pushed out?

charlesdwmorrison avatar Sep 21 '22 21:09 charlesdwmorrison

Hi @charlesdwmorrison! My mistake, I should not have put any milestone on this ticket, as far as we know, sprint ended on 12th of September and roll out is supposed to have happened (@dogirala could you confirm?).

If you have tested and you are still experiencing the issue, please let us know and we will ping Azure DevOps team.

Evangelink avatar Sep 22 '22 07:09 Evangelink

@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. image Other ex pipeline: image

dogirala avatar Sep 22 '22 07:09 dogirala

Got to know that this is expected as the deployments are still not completely done and they are in progress. Eta is by end of next week.

dogirala avatar Sep 22 '22 17:09 dogirala

The fix is deployed now. All deployments are completed

dogirala avatar Oct 02 '22 17:10 dogirala

I will move forward and close this ticket. Please if anyone is still experiencing issue either comment below or create a new ticket and we will handle it.

Evangelink avatar Oct 03 '22 06:10 Evangelink

I'm confused. I thought there would be a new version of MSTest released to fix this issue. I'm not seeing a new version on NuGet.org.

https://www.nuget.org/packages/MSTest.TestFramework/2.3.0-preview-20220810-02#versions-body-tab

MattBussing avatar Oct 03 '22 19:10 MattBussing

I am still seeing the same test case count as I have been for the past two years. In the test shown in the screenshot below, there are 126 data driven tests (in the form of an Excel spreadsheet). But the test results are only showing 1 test. Where would the data driven counts show up?

image

charlesdwmorrison avatar Oct 03 '22 20:10 charlesdwmorrison

I'm confused. I thought there would be a new version of MSTest released to fix this issue. I'm not seeing a new version on NuGet.org.

https://www.nuget.org/packages/MSTest.TestFramework/2.3.0-preview-20220810-02#versions-body-tab

I'm also a bit confused. My understanding now is that the discussed fix from above is not a fix to MSTest but the test results view in the build results, i.e. that the new test results format will now be visualized similarly to before the MSTest test results format change, right? How can I make use of this when using Azure DevOps Server (i.e. on-prem)?

ChristoWolf avatar Oct 03 '22 20:10 ChristoWolf

For on-prem I think you'll need to download the latest agent and configure it for the new changes to be included

dogirala avatar Oct 03 '22 20:10 dogirala

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.

Evangelink avatar Oct 04 '22 09:10 Evangelink

I believe that is correct, Our AzDo instance is hosted by Microsoft, but we have our own agent machines. So that is "not on prem."

charlesdwmorrison avatar Oct 04 '22 15:10 charlesdwmorrison

For on-prem instances, as per my knowledge you need to configure a new Agent or update the existing Agent in the AgentPool section of organization for the latest changes to pick up:

new agent: image

image

Update agent:

image

dogirala avatar Oct 10 '22 09:10 dogirala