I have a strange problem with DotNetCoreCLI@2 task. I am trying to add filter in the arguments, so only specific tests can run. I am using xUnit and Trait attribute for the goal.
[Trait("Category", "UnitTest")]
Task:
task: DotNetCoreCLI@2
displayName: Run unit tests
inputs:
command: test
projects: '**/*.Tests.csproj'
publishTestResults: true
arguments: >-
-c $(buildConfiguration)
--collect:"XPlat Code Coverage"
-- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=cobertura
--filter Category=UnitTest
But when I change/rename the attribute name, its still find and run the tests. Example:
[Trait("Category", "NotUnitTest")]
When I run dotnet test command localy, the filtration works. And when I change/rename the atribute, no test is run (as expected).
dotnet test --filter Category=UnitTest
Any ideas ?
Try to use quotation marks.
--filter "Category=UnitTest"