1

I have a bunch of unit tests (Test1, Test2, etc.), but rather than having them run automatically, I'd like to do something similar to the following:

List<Test> tests = {
    Test1,
    Test2,
    Test3,
    ...
}

The goal of doing so is to be able to comment out/uncomment (enable/disable) swaths of tests easily to isolate the ones in which I'm immediately interested.

Is that possible, or am I stuck with adding/removiong [disabled] tags to every test header?

Benjin
  • 2,264
  • 2
  • 25
  • 50

2 Answers2

1

Visual Studio allows creation and running of Test Lists. Just pick Test -> Create Test List... from the menu. You can then run just the tests in any particular list you've defined.

Andrew Cooper
  • 32,176
  • 5
  • 81
  • 116
0

If NUnit is an option, you can use the TestCaseAttribute. ReSharper really ties this in well with Visual Studio.

Based on this answer, MSTest doesn't support this.

Community
  • 1
  • 1
Austin Salonen
  • 49,173
  • 15
  • 109
  • 139