[# VS11] What happened to my unit tests migrated from # VS2010?



After a good while working with Visual Studio 11 and ReSharper 7, because will already grasping you hand. Those who complain of the icons and the Look & Feel because they complain free because in reality, once you get used to it or you realize that has changed the IDE.

Clarification: I personally think that if the colors of the VS11 IDE you bothered, is that these more concerned by the IDE for the code… should not be so.

But hey, how they have changed quite a lot, if it is important to know and learn about them. One of them is that now withVisual Studio 11 we can integrate the implementation of unit testing with different set of unit tests, nUnit, MSTest, etc. But of course to support this scenario, have had to modify the way in which Visual Studio 2010 worked tied to MSTests.

Let’s see an example. I have a solution in Visual Studio with a ClassLibrary featured Foo() and Bar(), and then 2 unit tests with the following code.

   1: [TestMethod()]

   2: public void AskForFooAndGetFoo()

   3: {

   4:     var target = new Class1();

   5:     var actual = target.Foo();

   6:     Assert.AreEqual("Foo", actual);

   7: }


   9: [TestMethod()]

  10: public void AskForBarAndGetBar()

  11: {

  12:     var target = new Class1();

  13:     var actual = target.Bar();

  14:     Assert.AreEqual("Bar", actual);

  15: }

As I am an organized person, was created my list of tests


and of course, the unit tests passed OK and code coverage was very good.


Until here everything great. And I so happy working with Visual Studio 2010.

However, things change a bit when we open the same solution with Visual Studio 11 we see that the lists of tests are not more supported. We can see the tests and the categories that we have created, but you can not run tests.


The reference article that redirected to us, it is very good although I am sure that will change in the near future.

For the implementation of unit testing, now have a new panel in Visual Studio 11 called "Unit Test Explorer". And here’s an interesting detail about the operation of the aircraft.

The "Unit Test Explorer" pane, is responsible for inspecting the code of our solution automatically and detects the unit tests in the same.


Then we can run the unit tests, launching the failed tests, which have passed correctly, etc.


We also have the ability to filter by these views and select the TestSettings with which we want to run the tests.

But the best (or one of the best things) is slightly hidden. Now the IDE allows us to configure Visual Studio 11 so that the unit tests run automatically after each compilation (something which previously made with a MACRO).


So… our tests is not lost, we only have to organize them again. And it is also a great time to review our evidence, starting with the same name.

Said it this morning via Twitter the ReSharperteam. @ ReSharper

Documenting a method name with a comment? Try giving it a better name. Better name doesn’t fit in one line?Now you have a serious issue!

Saludos @ Home

El Bruno

image image image

References: http://msdn.microsoft.com/library/dd286595(VS.110).aspx

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s