Share →
Buffer
James Tupper ( Mugshot )

Introduction

In Visual Studio 2010, you had the capability of opening up the Test Impact Analysis (TIA) window, running your unit tests, and getting test impact analysis results. While Test Impact Analysis has not been taken out of Visual Studio 11, it has radically changed.

Visual Studio 2010

Below is a screen shot of what Test Impact Analysis looks like in Visual Studio 2010:

Figure 1: Test Impact Analysis in Visual Studio 2010

This specific window can be refreshed after a build occurs, thus giving a developer information about which unit tests were affected with their code changes. As you can see, it is split into Impacted Tests and Code changes. Basically, it is showing someone the tests that should be run again, and the reason for those tests to be run again. There is even a link at the top of the window that one can click to run the tests that have been detected to be affected. If enabled in the test settings for that solution, this data would automatically be collected and saved in the background without the developer having to pay much attention to it until needed.

Overall, this is really nice to have. For instance, if a developer is fixing a bug but the method is used for another, unknown reason, then they would want to be sure to know what tests to run in order to make sure that their method worked for both scenarios. It would also save a tester from having to run every single test whenever code is changed.

Visual Studio 11

In this new release of Visual Studio, Test Impact Analysis has not disappeared, but is not in any way the same. No longer is there a Test Impact View, or any way to see test impact analysis results in Visual Studio 11. In fact, many options that were once available in 2010 have been removed/changed in 11.

image

Windows sub-menu in Visual Studio 11

image

Windows sub-menu in Visual Studio 2010

These are all the options that are now available within the Windows sub-menu (under Unit Test, deemed Test in Visual Studio 2010) of Visual Studio 11, and, as you can see, there are only two windows now available: Unit Test Explorer and Code Coverage Results. This is a drastic difference compared to the six separate views you could find in 2010. However different this may be, it does not mean that they have cut these features out. In Visual Studio 11, you can find the features in Test View, Test Results, and Test Runs in the Unit Test Explorer. It’s as if they have moved everything into an all-in-one view, which, in my opinion, is sweet! Obviously, the Code Coverage Results still exists, and you will see the same feature set there. The two that I have left out, Test List Editor and Test Impact View, no longer exist.

Test List Editor

Given that this is not the main topic of this post, I will only briefly cover it. There are no longer ides of lists of tests. Many people use lists to organize their tests into buckets such as continuous integration tests, regression tests, nightly tests, etc. For instance, when going to put a specific test list into a build, it no longer exists.

image

Adding Tests to a Build Definition

To get similar functionality during builds, one would have to categorize the test(s) in code instead of putting them into lists that exist outside of the code.

Test Impact Analysis

Test impact analysis in Visual Studio 11, like stated previously, no longer exists for developers on their local machines. It has been pulled out, and now only exists in builds. To enable test impact in a build definition, you will have to set the Analyze Test Impact option to true. It is located in the Process tab, under the Advanced node.

image

Setting the ‘Analyze Test Impact’ setting to true

This will allow for a build to analyze the code after the build and collect the appropriate data about which tests have been impacted due to code changes. Microsoft Test Manager (MTM) will now be the channel to go through to view test impact analysis results and to re run the appropriate tests in MTM.

Conclusion

All in all, the major change from Visual Studio 2010 to Visual Studio 11 is that test impact analysis is no longer in the development environment. No longer can you write code, build it locally, and view the test impact results; however, running an actual build, getting the results back, and running tests that have be defined in MTM can still be achieved. Also, there is no logic behind running only the unit tests that have been impacted by code changes; this is not even an option on the build definition. There are more changes in the testing portion of Visual Studio 11, but the main focus of this post was on the removal of the test impact view within Visual Studio.

-Find other related Dev on Demand Videos.

Do you want to move to Visual Studio 11 NOW? It is available for install today! For help moving forward, please contact Rick.Flath@nwcadence.com.

Print Friendly
Tagged with →  
  • Nitin Kelkar

    Still can we get the unit tests impacted at Build level?

  • You can in the legacy XAML build system, but the new task based Build system in TFS 2015 does not yet support it. If you need TIA you should use the TFS 2010/2013/2015 legacy XAML builds…