To profile unit tests from the Visual Studio editor using ReSharper and dotTrace
  1. Open a solution in Visual Studio.
  2. Open a file with unit tests.
  3. Choose a test class or a test method.
  4. Click the corresponding side bar mark in the left gutter.
  5. In the context menu, choose Profile with dotTrace:
    Profiling_Tests_with_Unit_Test_Runner
  6. The Unit Test Sessions window opens.
  7. The Profiler Configuration dialog box opens, where you should specify Profiling type and Measure or accept default values. For more information, see and .
  8. Optionally, click the arrow to display and configure additional settings, such as High accuracy, Enable inlining, Merge threads with equal names etc.
  9. After test execution is completed, a snapshot is be displayed.
To profile unit tests from ReSharper's Unit Test Sessions window
  1. Select a node in the tree view of the Unit Test Sessions window.
  2. Click Profile Selected Tests ico_unittest in the toolbar.
  3. The Profiler Configuration dialog box opens, where you should specify Profiling type and Measure or accept the default values. For more information, see and .
  4. Optionally, click the arrow to display and configure additional settings, such as High accuracy, Enable inlining, Merge threads with equal names etc.
  5. After test execution is completed, a snapshot will be displayed.
To profile unit tests using standalone dotTrace
  1. Run dotTrace as a standalone application.
  2. Do one of the following:
    • On the menu bar, choose File | Profile. The Profile dialog box opens. Click Standalone Application, then click OK or just double-click Standalone Application.
    • Click Profile on the Home tab. Click Standalone Application in the drop-down list.
  3. The Profiler Configuration dialog box opens.
  4. By default, your application will be profiled on the local computer. If you want to start profiling on a remote computer, click Profile on remote computer to change host settings. For more information, see .
  5. Depending on which unit testing framework is installed, specify the path to its executable file in the Application field. Your can work with the following frameworks/executables:
    • nunit.exe for nUnit.
    • nunit-console.exe for nUnit.
    • MSTest.exe for MSTest.
    • xUnit-console.exe for xUnit.
  6. Specify the path to the .dll file with your unit tests and add arguments (if necessary) in the Arguments field.
  7. Optionally, click the arrow to display and configure additional options, such as Working Directory and Profile child processes.
  8. Specify Profiling type and Measure, or accept default values. For more information, see and .
  9. If you want dotTrace Performance to start taking measurements after you explicitly tell it to do so, clear the Start profiling immediately check box.
  10. Optionally, click the arrow to display and configure additional settings, such as High accuracy, Enable inlining, Merge threads with equal names etc.
  11. Optionally, you can select the Use profiler API check box.
  12. Click Run.