These pages cover ANTS Performance Profiler 7, which is not the latest version. Help for other versions is also available.
Profiling tests in MSTest
Published 03 December 2012
MSTest is a software unit testing framework developed by Microsoft, which lets you create, manage, and run unit tests from within the Visual Studio IDE, as well as from the command line.
You can profile tests running in MSTest. Profiling your tests ensures that you're quickly alerted to any bottlenecks in your tests.
This page assumes that you're familiar with MSTest, and have already built an assembly full of tests that you want to profile.
Before you start profiling, you'll need a debug build of your test assembly.
Setting up the performance profiler
To profile .NET executables, on the ANTS Performance Profiler Settings dialog box, perform the following steps:
- Under Choose application type to profile, click .NET executable.
- Set the .NET executable box to the path where MSTest.exe is installed:
- For .NET 2.0 applications, this is often:
- For .NET 4.0 applications, this is often: %ProgramFiles(x86)%\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe
- For .NET 2.0 applications, this is often:
- Select the required Profiling mode, file I/O, and Profile child processes options; see Working with Application Settings.
- Specify the command line Arguments that are to be used when running the application.
Set a/testcontainer
argument to tell MSTest the path to the assembly that contains all of the tests. For example:
/testcontainer:"C:\Documents and Settings\<USER NAME>\My Documents\Visual Studio 2008\Projects\LoginForm\MyTests\bin\Debug\MyTests.dll" - If required, change the performance counters to record; see Setting up Charting Options.
- Click .
MSTest starts and executes all of the tests contained within the assembly.
During a profiling session you can interact with the profiler while your tests are still being profiled, and obtain results by selecting areas of the timeline.
When you have finished interacting with your application, click the
Stop Profiling button in ANTS Performance Profiler.