Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSTest.Engine/MSTest.SourceGeneration not supporting generic test methods #5002

Open
Youssef1313 opened this issue Feb 13, 2025 · 3 comments

Comments

@Youssef1313
Copy link
Member

<Project Sdk="MSTest.Sdk/3.8.0">

  <PropertyGroup>
    <TargetFramework>net9.0</TargetFramework>
    <LangVersion>latest</LangVersion>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <EnableMSTestRunner>true</EnableMSTestRunner>
    <OutputType>Exe</OutputType>
    <TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
    <TestingPlatformShowTestsFailure>true</TestingPlatformShowTestsFailure>
    <PublishAot>true</PublishAot>
  </PropertyGroup>

</Project>
using System.Numerics;

namespace TestProject33;

[TestClass]
public sealed class TestClass1
{
    [TestMethod]
    [DataRow(2, 5, 10)]
    [DataRow(2.0d, 5.0d, 10.0d)]
    [DataRow(5, 5, 25)]
    [DataRow(5.0d, 5.0d, 25.0d)]
    public void TestMethod1<T>(T number1, T number2, T expectedResult) where T : IMultiplyOperators<T, T, T>
    {
        Assert.AreEqual(expectedResult, number1 * number2);
    }

    [TestMethod]
    [DataRow(0)]
    [DataRow(1)]
    public void TestM2(int x)
    {

    }
}

Only TestM2 is run

@LucaBlackDragon
Copy link

LucaBlackDragon commented Feb 13, 2025

I'm seeing a similar issue in a ASP.NET 6 project, some of my tests decorated with [DataRow] or [DynamicData] are shown in the Test Explorer but skipped when I run tests with MSTest 3.8.0, while MSTest 3.7.3 runs all of them correctly.

I don't see related error messages or any other clue in test logs 😢

@Youssef1313
Copy link
Member Author

@LucaBlackDragon Thanks for reporting this. This issue is specific to a new feature in 3.8.0 which is not supported for MSTest.Engine/MSTest.SourceGeneration only. So, your issue is likely to be different. Can you please open a separate issue with more details on how your test look like, etc, and if you can provide us with a repro?

@Evangelink
Copy link
Member

Re-categorizing as feature request as the engine is totally different.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants