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

TestAdapter and overloaded parametrized test methods creates warnings and marks wrong status #1166

Open
jgraber opened this issue Apr 15, 2024 · 0 comments

Comments

@jgraber
Copy link

jgraber commented Apr 15, 2024

  • NUnit and NUnit3TestAdapter versions
    NUnit: 4.1.0
    NUnit3TestAdapter: 4.5.0

  • Visual Studio edition and full version number (see Help About)
    Microsoft Visual Studio Enterprise 2022 (64-bit) - Current
    Version 17.9.6

  • A short repro, preferably attached or pointing to a git repo or gist

  • What .net platform and version is being targeted
    .Net 8

Problem
We have two parameterized test methods with the same name in the same test file, but with a different method signature. When we run the tests with the ReSharper Test runner, it marks the tests from the second method as inconclusive and puts the parameters for the second method as pending under the first method.

TestRunner_Bug

2024.04.15 10:40:15.469 WARN Run: e6188ca1-157d-491e-bbf6-44a9ab53679c - Element <Demo.DemoProblemTestRunner.TestMethod(1,True)> doesn't exist in run
2024.04.15 10:40:15.469 WARN Run: e6188ca1-157d-491e-bbf6-44a9ab53679c - Element <Demo.DemoProblemTestRunner.TestMethod(2,False)> doesn't exist in run
2024.04.15 10:40:15.496 WARN Element <Demo.DemoProblemTestRunner.TestMethod(2,False)> was left Pending after its run completion.
2024.04.15 10:40:15.496 WARN Element <Demo.DemoProblemTestRunner.TestMethod(1,True)> was left Pending after its run completion.

Expected behaviour
We would expect that both test methods run and that all tests get the correct status.

Example

using NUnit.Framework;
using NUnit.Framework.Legacy;

namespace DemoRSharperTestrunProblem
{
    [TestFixture]
    public class DemoProblemTestRunner
    {
        [Test]
        [TestCase(Language.DE, true)]
        [TestCase(Language.EN, false)]
        public void TestMethod(Language language, bool expected)
        {
            var logic = new BizLogic();

            var result = logic.Method(language);
            ClassicAssert.AreEqual(expected, result);
        }


        [Test]
        [TestCase(1, true)]
        [TestCase(2, false)]
        public void TestMethod(int languageCode, bool expected)
        {
            var logic = new BizLogic();

            var result = logic.Method((Language)languageCode);

            ClassicAssert.AreEqual(expected, result);
        }
    }

    public class BizLogic
    {
        public bool Method(Language input)
        {
            if ((int)input == 1)
            {
                return true;
            }

            return false;
        }
    }

    public enum Language
    {
        DE = 1,
        EN = 2
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant