question-mark
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.

I can't figure out how to run a single test case

See original GitHub issue

I want to run a single [Fact] in my test assembly. I should be able to figure out how to do this using dotnet test --help without having to go to the internet where there is no documentation for this yet.

Here are my steps:

$dotnet test --help

Additional Arguments:
 Any extra command-line runsettings arguments that should be passed to vstest. See 'dotnet vstest --help' for available options.

$dotnet vstest --help

Options:

--Tests|/Tests:<Test Names>
      Run tests with names that match the provided values. To provide multiple
      values, separate them by commas.
      Examples: /Tests:TestMethod1
                /Tests:TestMethod1,testMethod2

$dotnet test --Tests:MyTest

MSBUILD : error MSB1001: Unknown switch.
Switch: --Tests:myTest

For switch syntax, type "MSBuild /help"

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
eerhardtcommented, Feb 11, 2017

Does this address the concern?

No. The Additional Arguments section doesn’t work, as pointed out above.

People coming from the project.json world are used to using the underlying test runner args (like xunit specific args) at the end of the command and those args getting passed through to the underlying test runner.

We should update the additional args message, or make the vstest args work correctly.

0reactions
livarcocccommented, Mar 28, 2018

The help has since been updated and particularly the runsettings now explicitly determines the – separator before passing commands to the runner directly.

I tried dotnet test -- --Tests:Test1 after creating a xunit project and it worked.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I run a single test using Jest?
From the command line, use the --testNamePattern or -t flag: jest -t 'fix-order-test'. This will only run tests that match the test name ......
Read more >
Unable to run a single unit test case through Test Explorer
Open Visual Studio and open solution · Build solution · Run all tests (see all tests pass) · Open UnitTest1.cs · Add a...
Read more >
Fixed: Ability to efficiently run single test cases (not just a file)
This would be fairly slow to run start-up and hard to remember the exact command, plus having to fish out the name of...
Read more >
Run Single Test - PyCharm Guide
Right-click on the test in the test tool listing and choose to run it. The definition of "one test" is also flexible: one...
Read more >
How to run a single test in PyCharm - YouTube
In this very short video you will learn how to speed up testing by focusing on one test only. 00:00 - Start 00:12...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found