In VS2012 (RC, soon to be RTM) is it possible to be selective about the (nunit) unit tests that run after every build? I love this feature, but I have two test categories/assemblies - one for actual unit tests that are expected to run quickly, another for database scheme and test generation data. I do not want to run the latter after every build, though I'd like to make use of this functionality for regular unit tests. Is there any way of specifying categories/assemblies/etc. that should be executed upon a successful build? Thanks JP
Run tests in Test Explorer If Test Explorer is not visible, choose Test on the Visual Studio menu, choose Windows, and then choose Test Explorer (or press Ctrl + E, T). As you run, write, and rerun your tests, the Test Explorer displays the results in a default grouping of Project, Namespace, and Class.
To start debugging: In the Visual Studio editor, set a breakpoint in one or more test methods that you want to debug. Because test methods can run in any order, set breakpoints in all the test methods that you want to debug. In Test Explorer, select the test method(s) and then choose Debug on the right-click menu.
You need to close the Test Explorer Window to prevent automatic running.
On the test explorer window, there is a searchbox. You can specify filters - one that looks promising is called a TestFilePath filter. (Dropdown to see available filters)
e.g. FilePath:"Transaction" filters only the tests in the Transactions.cs file. You can use this to exclude the tests in the other assembly e.g. if the folder is Unit and Database. Specifying FilePath:"Unit" should work. Give it a try..
Docs: Search for "filtering" on the page here
@Gishu is correct. If you apply a filter to the Test Explorer, the runner will use the results of that filter list when choosing tests to run.
We will be continuing to add additional filter choices (e.g. Categories, Project, etc.) to the Test Explorer through and post-RTM. Stay tuned for more on this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With