Our team has Visual Studio 2012 Professional licenses (not Test Professional). We are developing a smallish web application, and we have both true unit tests which mock everything needed, and tests for the data layer. Each class of data layer tests creates the whole database from scratch and fills it with a prepared set of test data, so running them takes a long time. As a result, we are reluctant to do a "run all", and our unit tests (which are quick) are only used rarely.
We are looking for a low-friction solution which will allow us to run all quick tests with 2-3 clicks (similar to the existing Run all) frequently, and easily run all tests when needed.
We tried making a playlist of the quick tests only. But we are done with programming the data layer, so practically all new tests we write are quick tests, and adding each of them to the playlist is annoying and somewhat error-prone. We would prefer an approach where we somehow mark the tests we do not want in a "quick run" as excluded, and it automatically runs all other tests in the solution. Note that we don't want to permanently add an Ignore attribute to the slow tests, as we still want to run them at least once daily.
To create a playlist, choose one or more tests in Test Explorer. Right-click and choose Add to Playlist > New playlist. To open a playlist, choose the playlist icon in the Visual Studio toolbar and select a previously saved playlist file from the menu.
If you want to enable or disable unit tests in Microsoft Visual Studio 2010, you can use the “Ignore” attribute. This can be used to ignore ore exclude integration tests in a nightly continuous integration build.
You need to close the Test Explorer Window to prevent automatic running.
You could use the Traits feature in mstest to accomplish this. Take a look at this blog post: https://devblogs.microsoft.com/devops/how-to-manage-unit-tests-in-visual-studio-2012-update-1-part-1using-traits-in-the-unit-test-explorer/
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