views:

58

answers:

4

I remember something like 'explicit', and google says that nunit has such attribute. Does Microsoft.VisualStudio.TestTools.UnitTesting provide something like this?

A: 

You may find The MSDN's discussion of the different mechanisms to enable/disable unit tests to be informative.

Brian
+2  A: 

The MSTest tools does not explicitly support this type of behavior at an attribute level. At the attribute level you can either enable a test via the TestMethod attribute or completely disable it with the Ignore attribute. Once the Ignore attribute is added, mstest will not run the test until it is removed. You cannot override this behavior via the UI.

What you can do though is disable the test via the property page. Open up the test list editor, select the test you want and hit F4 to bring up the property page. Set the Test Enabled property to false. The test will now not run until you re-enable it through the property page. It's not exactly what you're looking for but likely the closest equivalent.

JaredPar
Do you know, where this is stored? .csproj or .suo?
Sergey Osypchuk
@Sergey, I do not know but my guess is the .suo file
JaredPar
@Sergey: this Test Enabled property is stored in a solution-level `.vsmdi` file
AakashM
@Jared, it stores information in SolutionName.vsmdi (Microsoft Visual Studio test meta data file) and in this way all developers can have same settings using svn.
Sergey Osypchuk
@Aakash, thanks, I also found this
Sergey Osypchuk
A: 

I haven't used it, and it looks pretty old (Mar 2008), but I see that TestListGenerator claims to auto-generate Test Lists based on attributes you set on your tests. If it works, this would effectively provide Categories for MS Test. While not the same as Explicit, it may let you achieve what you want.

JeffH
A: 

You can create a "Run Manually" category for your tests using the Category attribute, and then exclude that category from your tests in the GUI. These tests will be grayed out, and you can put them back in whenever you want. I do this often for slow-running tests.

Mathias
Thanks, I will try - looks interesting
Sergey Osypchuk