Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you separate unit tests from integration tests in Visual Studio?

I've been using Visual Studio 2008 Test projects to store my tests. Lately I've realized that a lot of my unit tests are in fact integration tests because they rely on external sources (e.g. file system, SQL server, registry).

My question is, what is a good approach to separating out integration tests from unit tests?

Ideally I want only the unit tests to show up in the Test View, because I run them frequently during development. The integration tests on the other hand I don't want in the Test View because I will only run them infrequently, e.g. when I'm about to make a build drop.

like image 533
DSO Avatar asked Dec 12 '09 18:12

DSO


2 Answers

Keep them in separate projects, and keep the integration testing projects out of your day-to-day Visual Studio solutions.

When you wish to run the integration tests, you can use a different solution that includes them. If you don't want to wait for a second instance of VS to load, you can run them from the command-line.

like image 180
Mark Seemann Avatar answered Sep 28 '22 17:09

Mark Seemann


I put them in a separate project named IntegrationTests or something similar.

EDIT:

With Test View you can create lists & filter them:

http://msdn.microsoft.com/en-us/library/ms182452.aspx

And then run them:

http://msdn.microsoft.com/en-us/library/ms182470.aspx

like image 44
Kevin LaBranche Avatar answered Sep 28 '22 18:09

Kevin LaBranche