Caleb Bell
Caleb Bell

Reputation: 524

Is there a way to disable/ignore a Load Test in Visual Studio 2010 without using Test Lists?

I'm new to load testing in Visual Studio/MSTest, and I created a new Load Test recently to validate some high-traffic scenarios for a WCF service. I want to add this to the tests project for the service, but I don't want the test to be executed whenever I "Run All Tests in Solution" nor as part of our Continuous Integration build-verification process because a) it takes 5 minutes to run, and b) the service call that it is testing generates many thousands of email messages. Basically, I'd like to do the equivalent of adding the [Ignore] attribute to a unit test so that the load test is only executed when I explicitly choose to run it.

This MSDN Article ("How to: Disable and Enable Tests") suggests that the only to disable the test is to use Test Lists (.vsmdi files), but I don't have much experience with them, they seem like a hassle to manage, I don't want to have to modify our CI Build Definition, and this blog post says that Test Lists are deprecated in VS2012. Any other ideas?

Edit: I accepted Mauricio's answer, which was to put the load tests into a separate project and maintain separate solutions, one with the load tests and one without. This enables you to run the (faster-running) unit tests during development and also include the (slower-running) load tests during build verification without using test lists.

Upvotes: 1

Views: 1607

Answers (2)

Mauricio Aviles
Mauricio Aviles

Reputation: 1114

This should not be an issue for your CI Build Definition. Why?

To run unit tests as part of your build process you need to configure the build definition to point to a test container (usually a .dll file containint your test classes and methods). Load tests do not work this way, they are defined within .loadtest files (which are just xml files) that are consumed by the MSTest engine.

If you do not make any further changes to your CI Build definition the load test will be ignored.

If you want to run the test as part of a build, then you need to configure the build definition to use the .loadtest file.

Stay away from testlists. Like you said, they are being deprecated in VS11.

Edit: The simplest way to avoid running the load test as part of Visual Studio "Run All" tests is to create a different solution for your load tests.

Upvotes: 0

chaliasos
chaliasos

Reputation: 9783

Why don't you want to use Test Lists. I think is the best way to do that. Create different Test Lists for each test type (unit test, load test...) and then in your MSTest command run the Test List(s) you want:

  • MSTest \testmetadata:testlists.vsmdi \testlist:UnitTests (only UnitTests)
  • MSTest \testmetadata:testlists.vsmdi \testlist:LoadTests (only LoadTests)
  • MSTest \testmetadata:testlists.vsmdi \testlist:UnitTests \testlist:LoadTests (UnitTests & LoadTests)

Upvotes: 0

Related Questions