Cannot Profile Code when running unit tests via the command line
We are attempting to run performance profiling on our solution using DotTrace by running our unit tests through the command line. We can run the tests through the command line by targeting our tests in the DotTrace config file & using the ConsoleProfiler.exe. The snapshot that we capture using this method shows the profiling of the outer test runner without the profiling of our actual tests and resulting code. It appears that the process that our test results are on is terminating before the snapshot is captured. We are using NUnit as our framework & VS Test as our runner.
We have the same problem when running the tests through Standalone DotTrace. Although we see the profiling of our tests along with the outer test runner if we manually capture the snapshot before the process has finished.
When we target the unit tests through Visual Studio the tests are ran, the code profiled & the snapshot captured only contains the profiling results of our tests as oppose to the outer test runner, which is the desirable outcome.
Do you know why we cannot see the results of our tests being profiled in the snapshot that is captured through the command line? What are the key differences between the way Visual Studio & the Console Profiler run the tests & capture the profiling?
We have experienced this same issue with dotnet test and dotCover.
Please sign in to leave a comment.
Luke,
It looks like you need to use "--profile-child" parameter in console profiler to profile child processes of a unit test runner. Do you use this parameter?
Yes, we have tried that previously using the <ProfileChildProcesses>True</ProfileChildProcesses> element in our config xml & we get the same result, the profiling of the outer test runner & no unit tests. We also get the following message on the command line tool:
Instrumentation was requested, but wasn't made
We still think its because the process that our test results are on is terminating before the snapshot is captured.
Can you advise please?
Luke,
It is not because of the process termination.
Is "Use profiler API" option enabled in your configuration? You need to disable it in order to profile tests this way.