-
Notifications
You must be signed in to change notification settings - Fork 6k
Description
Using NUnit 3.12.0,
Trying to run something like this:
private static IEnumerable<object[]> LoginAsGuestSource()
{
yield return new object[] {5};
}
[Test]
[TestCaseSource(nameof(LoginAsGuestSource))]
public void LoginAsGuest(int i)
{
... ... ...
... ... ...
... ... ...
}
When I specify full test case name without parameters like:
dotnet test --filter "FullyQualifiedName=MyNamespace.MyTestClass.LoginAsGuest"
it throws an error:
No test matches the given testcase filter FullyQualifiedName=MyNamespace.MyTestClass.LoginAsGuestin C:\MyTestsProject\bin\Debug\netcoreapp2.2\MyTestAssembly.dll
When I specify parameters (no matter escaped or not):
dotnet test --filter "FullyQualifiedName=MyNamespace.MyTestClass.LoginAsGuest(5)"
dotnet test --filter "FullyQualifiedName=MyNamespace.MyTestClass.LoginAsGuest%285%29"
it throws an error:
An exception occurred while invoking executor 'executor://nunit3testexecutor/': Incorrect format for TestCaseFilter Missing Operator '|' or '&'. Specify the correct format and try again. Note that the incorrect format can lead to no test getting executed.
Test Run Failed.
When I remove both parameter for that method and TestCaseSource attribute, it runs successfully.
Adding .runsettings into command line doesn't work either:
dotnet test --filter "FullyQualifiedName=MyNamespace.MyTestClass.LoginAsGuest" -s mySettings.runsettings
mySettings.runsettings:
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<!-- Parameters used by tests at runtime -->
<TestRunParameters>
<Parameter name="i" value="5" />
</TestRunParameters>
</RunSettings>
Did I miss something in documentation or it's an existing limitation of .NET Core? If so, can it be added into the documentation as a limitation. Or there is another way how to specify test case parameters or escape ones?
edit by @mairaw: added document details
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 61ca4064-7481-a263-60fc-c70127f2ad16
- Version Independent ID: 2878af44-8208-7bd8-46d4-3acda3e82ce0
- Content: dotnet test command - .NET Core CLI
- Content Source: docs/core/tools/dotnet-test.md
- Product: dotnet-core
- Technology: dotnet-cli
- GitHub Login: @mairaw
- Microsoft Alias: mairaw