-1

I have group of tests divided to categories

[TestFixture]
[Category("someCategory")]
public class MyTestClass
{
    [Test, TestCaseSource("TestData")]
    public void MyTest(...)
    {
    }
}

I'm trying to get list of tests filtered by category via nunit3-console using

nunit3-console.exe --explore:results myTests.exe --where:"cat == someCategory"

However, it seems that --where option applies only for running tests and the results file contains list of all my tests, not only tests with category "someCategory".

How can I get a filtered list?

Guy
  • 46,488
  • 10
  • 44
  • 88

1 Answers1

0

The where filter is not currently applied when exploring tests. There is an issue to enable it for exploring tests. Add your comments along with your use case to help boost the visibility/priority of the issue if you want it changed. Pull requests are also welcome ;)

As a workaround, you could run your tests with your where clause and add --labels=All to output the tests to the console. The resulting list will need a bit of massaging in Notepad++, but it should give you what you need.

Rob Prouse
  • 22,161
  • 4
  • 69
  • 89
  • Thanks for answering. I'm trying to get the tests list before running the tests. The command kine is actually executed from C# code, I want this information in run time. – Guy Aug 03 '16 at 13:38
  • 1
    If that is the case, then you might be able to use the NUnit.Engine API directly, add the filters and do the explore. See starter code in the issue. Easier, you could submit a PR to NUnit to fix it and use a CI build until the next release next month :) – Rob Prouse Aug 03 '16 at 14:25