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 ther开发者_StackOverflow中文版e 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.
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:
- 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. - 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>
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.
精彩评论