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

p>image

Buenas,

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: }

   8:  

   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

image

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

image

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.

image

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.

image

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

image

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).

image

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

About these ads

Deja un comentario

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s