5

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.

Gordon Slysz
  • 1,083
  • 12
  • 23

2 Answers2

3

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>
0

I like to use build variables in my Post-build event command line in Visual Studio. The EQATECProfilerCmd does not like a backslash at the end of the path, so I do this:

"C:\Program Files (x86)\EQATEC\EQATECProfiler\EQATECProfilerCmd" -build "$(TargetDir)."

Note how I included a period at the end of the command. Also note how I put quotes around the path because I know there are spaces in the path.

Paul Chernoch
  • 5,275
  • 3
  • 52
  • 73
  • 1
    That silly behavior is due to Visual Studio, not the profiler: in VS, the TargetDir-variable always ends with a backslash so when VS expands "($TargetDir)" it becomes eg "C:\somepath\", ie with an escaped closing quote. That's just messed up, but the trick of adding a dot will produce "C:\somepath\." which is a proper path. – Richard Flamsholt Jun 19 '12 at 23:50