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.

An exception occurred while invoking executor 'executor://nunit3testexecutor/': Incorrect format for TestCaseFilter Error: Missing ')'.

See original GitHub issue

ENVIRONMENT


NUnit: 3.10.1 NUnit3TestAdapter: 3.10.0 Visual Studio: 15.9.2 .NET Platform: .NET Core 2.1

DESCRIPTION


When executing a category of tests, if a test is included in the list of tests that contains an opening parenthesis, but does not contain the closing parenthesis, the following error may occur, and the test run will fail:

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.

REPRODUCTION


This issue can only be reproduced when selecting a group of tests to run - selecting individual tests, or selecting ‘Run All’ will no reproduce the issue.

It appears that reproducing the issue requires there to be a test that includes an opening parenthesis but does not include a closing parenthesis, and a test that ends with the closing bracket character (‘]’).

You should be able to reproduce the issue by using the following test code:

public class TestNameRepro
{
    #region TestCaseSource

    protected static IEnumerable TestName_TestCases
    {
        get
        {
            // Adding a parenthesis to the end of this test name will stop the exception from throwing (e.g. $"TestName(...)")
            yield return new TestCaseData(1).SetName($"TestName(...");

            // Cannot be duplicated without a second test included that ends with a ']'
            yield return new TestCaseData(2).SetName($"TestName(...)]");
        }
    }

    #endregion     
    [Test, TestCaseSource(nameof(TestName_TestCases))]
    public void TestName(int input)
    {
        // Irrelevant  
    }
}

Once built, categorize the test explorer using the ‘Class’ category selection, and select the test suite ‘TestNameRepro’ and click ‘Run Selected Tests’: image

The ‘Tests’ output window should display the error mentioned above:

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.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:30 (14 by maintainers)

github_iconTop GitHub Comments

3reactions
Dragonsangelcommented, Nov 11, 2019

As an update to this, I tested the fix with the 3.16.0-dev-01202 package and this Test is not run with the same error message as described in this issue.

Error] 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.

public class TupleUnitTests
{
	[Test]
	[TestCase(typeof(IDummy<(String body, Dictionary<String, String> applicationData), String>))]
	public void UnitTest_TestCaseWithTuple_TestIsNotExecuted(Type targetType)
	{
		Assert.That(targetType, Is.Not.Null);
	}
}

public interface IDummy<T1, T2> : IList<T1> { }

If I however switch around the Types, then it will execute [TestCase(typeof(IDummy<String, (String body, Dictionary<String, String> applicationData)>))]

Summary: TestCase[Type<Tuple(), Type>] Error TestCase[Type<Type, Tuple()>] Executed

1reaction
goamncommented, Mar 4, 2022

Happened to me on VS2022. Fixed it by removing the “{m}” modifier inside of the property TestName.

Read more comments on GitHub >

github_iconTop Results From Across the Web

.NET NUnit Parallel Tests: Incorrect format for TestCaseFilter ...
An exception occurred while invoking executor 'executor://nunit3testexecutor/': Incorrect format for TestCaseFilter Missing Operator '|' or '&'.
Read more >
Visual Studio can't run a unit test (An exception occurred ...
I have Visual Studio Test Adapter so I see my tests in Test Explorer. I have Visual Studio 2013 Update 5. The problem...
Read more >
Parameterized test case fails when it has a "(" in a string
[2017-11-07 15:15:26 Error] An exception occurred while invoking executor 'executor://nunit3testexecutor/': Incorrect format for TestCaseFilter ...
Read more >
Adapter V3 Release Notes
622 An exception occurred while invoking executor 'executor://nunit3testexecutor/': Incorrect format for TestCaseFilter Error: Missing ...
Read more >
Solving Long, flaky testing with Azure DevOps - Tsuyoshi Ushio
We encounter this error. An exception occurred while invoking executor ... Incorrect format for TestCaseFilter Missing Operator '|' or '&'.
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