如何使用 dotTrace 4.0、ReSharper 5.1 和 VS2008 通过 MSTest 分析单元测试?

发布于 2024-10-02 11:05:12 字数 805 浏览 0 评论 0原文

我正在尝试使用 dotTrace 4.0 分析单个单元测试(测试本身通过)。 看来 dotTrace 分析的是 Resharper 的测试运行程序,而不是分析测试本身。

我可以从 JetBrains 开发团队找到有关 dotTrace 3.1 问题的答案: MSTest 似乎创建了一个用于运行测试的新进程,并且 dotTrace 3.1 的一个已知限制是它无法处理此行为。

可以使用命令行中的 /noisolation 选项来抑制 MSTest 的这种行为,但不能在 IDE 中完成。

此页面在这里: http://confluence.jetbrains.net/display/NetProf /分析+单元+测试+with+dotTrace+4.0 还告诉我,使用 dotTrace 4.0 和 ReSharper 5.0,它应该可以开箱即用。

但事实并非如此。

因此,我尝试从 dotTrace 的独立 UI 运行测试,如上面链接中所述,它实际上可以达到目的,但有限制:

  • 所描述的方法运行指定 dll 中的所有测试。用于启动测试的参数也许可以调整以运行一个特定的测试,但仅运行一个小型 UT 似乎很麻烦。
  • 看来我的所有源代码都没有附加到会话中,这需要更多时间来纠正。

我检查了 VS 选项、ReSharper 选项、.testrunco​​nfig 选项,但没有任何运气。 以前有人解决过这个问题吗?

I am trying to profile a single unit test (the test itself passes) using dotTrace 4.0.
It seems that dotTrace profiles Resharper's test runner instead of profiling the test itself.

I could find an answer from JetBrains dev team regarding this issue with dotTrace 3.1:
it seems that MSTest creates a new process for running tests, and it was a known limitation of dotTrace 3.1 that it could not handle this behaviour.

This behaviour of MSTest can be inhibited using the /noisolation option in command line, but it cannot be done from within the IDE.

This page here:
http://confluence.jetbrains.net/display/NetProf/Profiling+Unit+tests+with+dotTrace+4.0
also tells me that using dotTrace 4.0 and ReSharper 5.0, it should work out-of-the box.

Which it does not.

So I tried to run the test from the standalone UI of dotTrace as explained in the above link, it actually does the trick but with limitations:

  • the described method runs all tests within a specified dll. The arguments used to launch the test could maybe be tuned to run one specific test, but it seems a lot of trouble for running just one tiny UT.
  • it seems all my source code is not attached to the session, which takes some more time to correct.

I went through VS options, ReSharper options, .testrunconfig options, without any luck.
Anyone has solved this before?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

情感失落者 2024-10-09 11:05:12

其实ReSharper中有一个我没见过的选项:ReSharper>选项>工具>单元测试> MS测试>使用此测试运行配置
当我将其设置为默认值时,它运行得很好。

毕竟我的测试配置出了问题。我不知道出了什么问题,因为与默认值的唯一区别是我启用了部署,并使用了一些用于我现在未使用的测试项目的 XML 文件。我也不明白这与我的问题有什么关系。

无论如何,既然它是这样工作的......

Actually there was an option in ReSharper that I had not seen: ReSharper > Options > Tools > Unit Testing > MSTest > Use this Test Run Configuration
When I set this to default it runs just fine.

Something is wrong in my test configuration after all. I do not know what is wrong, since the only difference with default is that I have Deployment enabled with a few XML files that are used for a test project I am not using right now. And I do not understand either how that relates with my problem.

Anyway, since it works like this...

樱娆 2024-10-09 11:05:12

这可能是由 Visual Studio 附带的内置代码覆盖率引起的。请确保您的解决方案已将其关闭。

WBR,奥列格·斯捷潘诺夫
JetBrains公司
“快乐地发展!”

This might have been caused by built-in code coverage which comes with Visual Studio. Please make sure it's turned off for your solution.

WBR, Oleg Stepanov
JetBrains s.r.o.
"Develop with pleasure!"

叶落知秋 2024-10-09 11:05:12

我使用了 jetBrains 上提供的文章

我配置了一个测试,例如:

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" /Platform:x64 /InIsolation /Logger:trx Tests.dll /TestCaseFilter:"PricesTest"

当我使用此配置时,它没有显示任何内容。有用的是删除所有参数,除了:

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" Tests.dll /TestCaseFilter:"PricesTest"

I have used article that is available on jetBrains

I have configured a test like:

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" /Platform:x64 /InIsolation /Logger:trx Tests.dll /TestCaseFilter:"PricesTest"

When I used this configuration it was not showing anything. What helped was removing all arguments except:

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" Tests.dll /TestCaseFilter:"PricesTest"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文