I can't figure out how to run a single test case
See original GitHub issueI 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:
- Created 7 years ago
- Comments:8 (7 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
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.