Search code examples
c#c#-4.0nunittestdriven.neteqatec

Is there a way to use EQATEC profiler on my NUnit Unit tests?


I'd like to use the EQATEC profiler on my NUnit unit tests, just like I used to do with JetBrains dotTrace in conjunction with TestDriven.NET and NUnit. Is there a way to do this? As it is, it seems that I need to wrap my UnitTest in a console app and then use the profiler on that.


Solution

  • EQATEC Profiler is actually quite suited for automation: it has a command-line version and an API with which you can control most aspects of the profiling, and you'll simply have to use that in your unit-tests.

    The API is described in the profiler's user guide. What you want to do is probably something like this:

    1. First add a reference to the profiler-API. You'll find assemblies for four different platforms in the installed RuntimeDLL-folder. You're probably looking for EQATEC.Profiler.RuntimeFullNet.dll, but there are also implementations for NetCF, Silverlight, and WP7.
    2. Now you can add code to your unit-tests to take timing-snapshots whenever you want to and have them saved to a file of your choice using the EQATEC.Profiler.Runtime.TakeSnapshot() methods. Those report-files can later be inspected in the profiler.

    Remember that you still need to instrument your compiled unit-test with the profiler and run the instrumented versions, but this can be automated with the command-line version of the profiler, EQATECProfilerCmd.exe. It's really simply to use and goes like this:

    EQATECProfilerCmd -build <your app directory>