Profiling Unit Tests with dotTrace Profiler

Profiling unit tests from Visual Studio is performed with JetBrains dotTrace Profiler´┐Ż. dotTrace Profiler is a powerful, yet easy-to-use .NET profiler. It profiles .NET Framework 1.1 and 2.0 applications including ASP.NET applications running on Internet Information Server. For more details about working with dotTrace Profiler, please see its documentation or go to http://www.jetbrains.com/profiler (free 30-day trial download is available).

To be able to profile unit tests, make sure that the current release version of dotTrace Profiler is installed on your system.

You can profile unit tests in several different ways.

To Profile Tests from the Code Editor:

For test classes and individual tests ReSharper adds special sidebar marks in the code editor.

 

To profile a test class, ´┐Żlick the corresponding sidebar mark to the left of the test class declaration and then click Profile <ClassTestName>:

To profile an individual test, click the corresponding sidebar mark to the left of the test declaration and then click Profile <TestName>:

After you've clicked one of the Profile commands described above, the appropriate test or test class will be run in Unit Test Runner window AND profiled in dotTrace. You can start profiling several tests or test classes separately: each will be profiled in its own instance of dotTrace.

To Profile Tests from Unit Test Runner Window:

You can also profile unit tests if Unit Test Runner window is opened. The window is displayed after you've run one or more test. Also, you can open the window from ReSharper menu: click Window | Unit Test Runner.

To profile a test or test class from Unit Test Runner window, do one of the following:

For more details see the Unit Test Runner Window topic.

See Also

Running and Debugging Unit Tests | Unit Test Runner Window