有没有办法在我的 NUnit 单元测试中使用 EQATEC 分析器?

发布于 2024-11-09 20:04:43 字数 146 浏览 0 评论 0原文

我想在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

瑶笙 2024-11-16 20:04:43

EQATEC Profiler 实际上非常适合自动化:它有一个命令行版本和一个 API,您可以使用它来控制分析的大部分方面,并且您只需在单元测试中使用它即可。

该 API 在探查器的用户指南中进行了描述。您想要做的可能是这样的:

  1. 首先添加对探查器 API 的引用。您将在安装的 RuntimeDLL 文件夹中找到适用于四个不同平台的程序集。您可能正在寻找 EQATEC.Profiler.RuntimeFullNet.dll,但也有针对 NetCF、Silverlight 和 WP7 的实现。
  2. 现在,您可以将代码添加到单元测试中,以便随时拍摄定时快照,并使用 EQATEC.Profiler.Runtime.TakeSnapshot() 方法将它们保存到您选择的文件中。稍后可以在分析器中检查这些报告文件。

请记住,您仍然需要使用探查器来检测已编译的单元测试并运行已检测的版本,但这可以使用探查器的命令行版本 EQATECProfilerCmd.exe 来自动化。使用起来非常简单,如下所示:

EQATECProfilerCmd -build <your app directory>

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>
情痴 2024-11-16 20:04:43

我喜欢在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文