Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Option --list-tests should take into account --filter option

See original GitHub issue

I’m trying to execute one particular test so I specify a filter, but dotnet test executes several tests. So I need to understand what tests my filter captures. I would expect that --list-tests with --filter tells me. But it doesn’t. --list-tests always shows all tests ignoring --filter option which is a pity.

Steps to reproduce

dotnet test Tests.csproj --list-tests --filter FullyQualifiedName~MyClass.MyMethod

lists only tests satisfying the filter

Expected behavior

lists only tests satisfying the filter

Actual behavior

lists all tests in assembly

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:31
  • Comments:16 (2 by maintainers)

github_iconTop GitHub Comments

wli3commented, Aug 23, 2017

Hi @evil-shrike thank you for the issue. You are correct, --list-tests only lists all the tests. We will discuss this enhancement.

Hi @Faizan2304 is there any existing vstest API can do that?

shatulskycommented, Mar 17, 2023

Workaround for this case using nunit3-console

choco install nunit-console-runner
nunit3-console.exe "C:\Projects\MyProject\Tests\bin\Debug\net7.0\Tests.dll" --where="cat==Smoke||cat==ProdHealthCheck" --explore

filters format for dotnet test and nunit3-console are different In my case to convert my filer from TestCategory=Smoke|TestCategory=ProdHealthCheck to cat==Smoke||cat==ProdHealthCheck I had to make a few replaces

TestCategory -> cat
= -> ==
| -> ||

And as a result, the --where + --explore attributes output only the test list that matches the specified filter as expected.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet test command - .NET CLI
Filters tests in the current project using the given expression. Only tests that match the filter expression are run. For more information, see ......
Read more >
dotnet vstest command - .NET CLI
The dotnet vstest command builds a project and all of its dependencies.
Read more >
Jest CLI Options
Jest CLI Options. The jest command line runner has a number of useful options. You can run jest --help to view all available...
Read more >
Filter an array taking into account that the filtered options ...
I have a code that should filter the array depending on some condition. One time it could be 1 condition or 2, depending...
Read more >
Tempest Run
Tempest Run¶. Runs tempest tests. This command is used for running the tempest tests. Test Selection¶. Tempest run has several options:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found