I have a C# solution where there are several unit test projects that use xUnit and an "end to end" tests project that uses NUnit. (This is intentional and fine so I'd appreciate not trying to convince me to ditch one for the other, thanks)
I use an Azure DevOps Pipeline to build, test and package my solution. This is my test step (from azure-pipelines.yml) at the moment:
- task: DotNetCoreCLI@2
displayName: 'Run tests in solution'
inputs:
command: 'test'
arguments: '--configuration $(buildConfiguration) --collect "Code coverage" --filter Category!=Integration'
publishTestResults: true
When I run this my pipeline fails with this error message:
An exception occurred while invoking executor 'executor://nunit3testexecutor/': Unexpected Word 'Category' at position 29 in selection expression.
I'm pretty sure this happens because NUnit is getting picked up and it does not understand the Category
filter term. (NUnit expects the term TestCategory
instead)
I tried getting the pipeline to not pick up the NUnit project (called "EndToEnd")this way:
--filter FullyQualifiedName!~EndToEnd&Category!=Integration'
But this does not work and I get the same error message.
How can I get Azure DevOps Pipelines to only run the tests in my xUnit projects in this step and not fail because of the presence of the NUnit project?
projects: '**/*.Tests.csproj'
. I think an even better solution might be:projects: !'**/*.EndToEnd.csproj'
– urig