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

Parametrized test not run from TestCaseSource when one argument is an array of tuple #873

Closed
DmitryKondratenko1986 opened this issue Jul 7, 2021 · 3 comments
Labels
closed:fixedinnewversion This has been fixed in a newer version is:bug is:FQNIssue

Comments

@DmitryKondratenko1986
Copy link

DmitryKondratenko1986 commented Jul 7, 2021

Hello!

Environment:

NUnit v3.12.0
NUnit3TestAdapter v3.15.1
Microsoft.NET.Test.Sdk v16.4.0
Visual Studio Community 2019 16.10.2
.NET Core 3.1

Summary:

Unit tests parameterized with two parameters: the int and the array of tuples (int, int) (via TestCaseSource) is not run with Test Explorer's Run All button.

Expected Behavior:

All test cases are enumerated in Test Explorer with Fail or Pass statuses upon pressing Run All. In sample provided, it is expected that the test case will fail with a red X badge in Test Explorer.

Current Behavior:

Test Cases are not run, status for tests are unfilled blue badges. Outputs the following error:
========== Test discovery finished: 1 Tests found in 57 ms ========== ---------- Starting test run ---------- NUnit Adapter 3.17.0.0: Test execution started An exception occurred while invoking executor 'executor://nunit3testexecutor/': Incorrect format for TestCaseFilter Error: Missing '('. Specify the correct format and try again. Note that the incorrect format can lead to no test getting executed. ========== Test run finished: 0 Tests run in 57 ms (0 Passed, 0 Failed, 0 Skipped) ==========

Additional Notes:

My issue is very similar to [https://github.com//issues/782]
A workaround is observed: test runs if uncheck option "Discover tests in real time from C# and Visual Basic .NET source files" in Test/Option/General in the main menu. But in the test explorer in the "test detail symmary" section test marked as "No source available" so I can't swith to the test method if I press F12 button.

Repro steps:

  1. Create new .NET Core 3.1 class library project
  2. Add NUnit Test project to solution (w/ Nuget packages Microsoft.NET.Test.Sdk, NUnit and NUnit3TestAdapter )
  3. Add simple test class with the code below
  4. Open Visual Studio Test Explorer and press Run All.
  5. Observe blue unfilled status icons of tests, error in Output/Tests

Sample

[TestFixture]
public class SomeTests
{
    private static IEnumerable<TestCaseData> DataCases
    {
        get
        {
            yield return new TestCaseData(1, new (int, int)[] { (1, 2) });
        }
    }
    [TestCaseSource(nameof(DataCases))]
    public void SomeTest(int x1, (int, int)[] expected)
    {
        var actual = new (int, int)[] { (1, 2) };
        Assert.AreEqual(expected, actual);
    }
}
@OsirisTerje
Copy link
Member

This may be a FQN issue, but first try to upgrade adapter to either 3.17 or 4.0.0.

@OsirisTerje
Copy link
Member

This is a FQN issue, so we just have to wait for MS. It can't handle the parentheses coming in with the tests.

@OsirisTerje
Copy link
Member

@DmitryKondratenko1986 Checked this now with the latest adapter (and also version 4.1.), with SDK at 16.11.0 and VS 2022, (17.0.4), and it works now. So seems something has been fixed on the road here.
image

Issue code is here: https://github.com/nunit/nunit3-vs-adapter.issues/tree/master/Issue873

@OsirisTerje OsirisTerje added the closed:fixedinnewversion This has been fixed in a newer version label Dec 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed:fixedinnewversion This has been fixed in a newer version is:bug is:FQNIssue
Projects
None yet
Development

No branches or pull requests

2 participants