Running tests marked as [Explicit] with dotnet test

Viewed 1067

Is it at all possible to execute tests marked with the NUnit [Explicit] attribute using dotnet test?

I have some tests which I would like to be ran as a separate build on Bamboo. They take a while to run so didn't want them to be included in the standard test run in VS so marked them with the [Explicit] attribute. I also marked them with [Category("Nightly")] so on Bamboo I hoped to have a step of:

dotnet test --filter "TestCategory=Nightly"

but as expected they still get ignored because of the Explicit property.

I tried explicitly naming, like this:

dotnet test --filter "ClassName=MyTests.Tests.TestClassName"

but still no luck, I've tried all of the possible arguments to dotnet test https://docs.microsoft.com/en-us/dotnet/core/testing/selective-unit-tests?pivots=mstest to refer to the tests specifically but they still get ignored.

Has anyone managed this?

Rich

1 Answers

As per this Github issue this is actually a known bug with NUnit3TestAdapter where tests marked as [Explicit] would not execute regardless of how they were referenced in the arguments to dotnet test. This has been addressed in the latest pre-release version of the nuget package.

Related