question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TestAdapter: Wrongly grouped DataTestMethod

See original GitHub issue

Describe the bug

DataTestMethods are wrongly grouped with MSTest.TestAdapter in version 3.0.x (Grouping in VS is by Traits)

Wrong grouping: image

Expected grouping (achieved with MSTest.TestAdapter 2.2.x): image

Steps To Reproduce

Explore tests in this class:

using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace TestProject
{
    [TestClass]
    [TestCategory("L3")]
    public class BasicUnitTest : UnitTestBase
    {
        public override int TypeCount => 3;
    }
    
    [TestClass]
    [TestCategory("L3")]
    public class ExtendedUnitTest : UnitTestBase
    {
        public override int TypeCount => 8;
    }

    [TestClass]
    [TestCategory("L3")]
    public class UnitTestBase
    {
        public virtual int TypeCount => 5;

        [DataRow(1)]
        [DataRow(2)]
        [DataTestMethod]
        public void DocumentCostCurrentDataFunctions(int count)
        {
            Assert.IsTrue(count < TypeCount);
        }
    }
}

Expected behavior

Expected grouping (achieved with MSTest.TestAdapter 2.2.x): image

Actual behavior

Wrong grouping: image

Additional context

We also run tests in Azure DevOps wth vstest.console.exe "C:\abc.dll" /TestCaseFilter:"TestCategory=L3" "/logger:trx;LogFileName=C:\abc.trx" /TestAdapterPath:"C:\UnitTests\Tests" command. The test report file has changed after the libraries update.

AB#1813781

Issue Analytics

  • State:closed
  • Created 5 months ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
HightowerCZcommented, May 2, 2023

OK, I put the comment to the linked issue. Thank you for being so helpful!

1reaction
Evangelinkcommented, Apr 28, 2023

Hi @HightowerCZ,

I am waiting for a little more info about the change of behaviour in VS because it’s not yet fully clear if this is coming from a change caused by MSTest or VS Test Explorer. I will let you know more when I have some news.

Regarding the change in the trx, this is not linked to traits grouping but linked to a change of behavior (breaking change) that was introduced in 2.2.4. This is unfortunate but sadly we cannot easily change this on our side because we need to synchronize with Azure DevOps team to ensure the UI will reflect the change. To get more information about this change, I encourage you to refer to https://github.com/microsoft/testfx/issues/1024.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Wrongly grouped DataTestMethod · microsoft/testfx@68c9dfb
Search code, repositories, users, issues, pull requests... · Provide feedback · Saved searches · TestAdapter: Wrongly grouped DataTestMethod ...
Read more >
DataTestMethod and DataRow attributes in MSTEST
In a nutshell, you will need to install MSTest.TestFramework and MSTest.TestAdapter , and remove references to Microsoft.VisualStudio.
Read more >
Create Data-Driven Unit Tests - Visual Studio (Windows)
Learn how to use the Microsoft unit test framework for managed code to set up a unit test method to retrieve values from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found