We're using SpecFlow to generate our tests, and then running them using dotnet test. (We can't use the test runner, because we're on OS X and VS2019 for Mac doesn't add the SpecFlow tests to the Unit Tests pad).

I can filter on test name, but cannot filter on test class name.

Given the following generated test class:

namespace MyProject.App.Member.SpecTests.Features.Member.Account
    using TechTalk.SpecFlow;

    [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "")]
    [NUnit.Framework.DescriptionAttribute("Account Page")]
    public partial class AccountPageFeature
        // Test code here...

When I run done test with the command line:

dotnet test --framework netcoreapp2.1 --configuration Release --filter ClassName=MyProject.App.Member.SpecTests.Features.Member.Account.AccountPageFeature

I get the error:

No test matches the given testcase filter ClassName=MyProject.App.Member.SpecTests.Features.Member.Account.AccountPageFeature in /Users/jameslavery/GitHub/MyProject.mobile/test/MyProject.App.Member.SpecTests/bin/Release/netcoreapp2.1/MyProject.App.Member.SpecTests.dll

Using ClassName is documented here. I suspect it's because the generated class hasn't got the [TestClass] attribute.

Any pointers on how to get filtering by class working?

0 Answers