Jaa


Profiling a Unit Test

A little known feature of VSTS Team Developer is the ability to use the run-time analysis of the Profiler specifically targetting the code in a Unit Test.  There are a two key scenarios this integration feature targets:

  1. Collect Performance Data on Specific Code
    Normally you'd have to kick-off your entire application with profiling turned on and collect a potentially tremendous amount of data, just to analyses one small part of code.  With this, you can profile just a small specific section of code.
  2. Performance Regression Testing
    It is common to have a large number of unit tests.  One day you find one test takes notably longer than it used to in a test run.  How do you debug the performance degradation?  Use the profiler to target the slow unit test.

How do you do this? See this short <2 min video clip of Profiling a Unit Test to see it in action. 

  1. Create a new Unit Test
  2. Run the Unit Test
  3. In the Test Results tool window, right click the test run and choose Performance Test
  4. You can now run the new performance session from Performance Explorer.

Today profiling is limited to just unit tests (that do not target web services).  One of the features we're currently working on is the ability to profile web tests or load tests.

More Resources
Ian Huff, a dev on the profiler, has a great blog about profiling and specifically a post on the different ways to create a performance session.

Comments

  • Anonymous
    October 13, 2006
    Cool Idea Noah didn't think of that.  I'll recomment for sure we where not too sure of the utility of the perf tester because you needed to test the whole thing.  Now that is more targeted.  I like it. Cheers, ET

  • Anonymous
    June 27, 2007
    The Visual Studio Team System Profiler is a tool that helps find resource bottle necks in your application.