有没有办法在我的 NUnit 单元测试中使用 EQATEC 分析器?
我想在 NUnit 单元测试中使用 EQATEC 分析器,就像我以前将 JetBrains dotTrace 与 TestDriven.NET 和 NUnit 结合使用一样。有办法做到这一点吗?事实上,我似乎需要将我的 UnitTest 包装在控制台应用程序中,然后使用探查器。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
EQATEC Profiler 实际上非常适合自动化:它有一个命令行版本和一个 API,您可以使用它来控制分析的大部分方面,并且您只需在单元测试中使用它即可。
该 API 在探查器的用户指南中进行了描述。您想要做的可能是这样的:
EQATEC.Profiler.RuntimeFullNet.dll
,但也有针对 NetCF、Silverlight 和 WP7 的实现。EQATEC.Profiler.Runtime.TakeSnapshot()
方法将它们保存到您选择的文件中。稍后可以在分析器中检查这些报告文件。请记住,您仍然需要使用探查器来检测已编译的单元测试并运行已检测的版本,但这可以使用探查器的命令行版本 EQATECProfilerCmd.exe 来自动化。使用起来非常简单,如下所示:
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:
EQATEC.Profiler.RuntimeFullNet.dll
, but there are also implementations for NetCF, Silverlight, and WP7.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:
我喜欢在 Visual Studio 的构建后事件命令行中使用构建变量。 EQATECProfilerCmd 不喜欢路径末尾有反斜杠,因此我这样做:
“C:\Program Files (x86)\EQATEC\EQATECProfiler\EQATECProfilerCmd” -build “$(TargetDir).”
请注意我如何在命令末尾添加句点。
另请注意我如何在路径周围添加引号,因为我知道路径中有空格。
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.