How can I profile Unit Tests if dotTrace isn't integrated into ReSharper

If you don't want to integrate dotTrace into Visual Studio, or have incompatible versions of dotTrace and ReSharper, or don't have ReSharper at all, you can still profile your unit tests with a following workaround.

1. open your solution in Visual Studio;

2. launch standalone dotTrace as administrator;

3. in dotTrace click Profile -> .NET Process; "Profiler Configuration" dialog is opened

4. specify profiling options and click Run - dotTrace Controller is opened; all buttons are grey and "Process" dropdown is empty - it means that dotTrace doesn't profile anything right now, it's waiting for .NET process(es) to start;

5. run your unit tests - in dotTrace Controller there appears a process (or several processes), buttons become active, profiling is started. While the tests are being executed and their processes are finishing, you'll be getting a bunch of snapshots (the amount of snapshots is equal to the amount of processes that were run during executing your tests). Snapshots will be opened in standalone dotTrace instances;

NB: dotTrace finishes "listening" and profiling when the last process it has captured is finished. If there can be a pause in your tests' running, dotTrace will make use of it to stop working, and you'll only get the snapshots of first group of tests. To avoid it, in step 4 before you click Run press Ctrl+Shift+F11, click Expert Options and uncheck "Finish profiling automatically". Now dotTrace will profile all .NET processes that are launched until you manually close dotTrace Controller.

Please sign in to leave a comment.

Have more questions?

Submit a request