C# 什么是最好的 Nunit 测试运行器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/336655/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the best Nunit test runner out there?
提问by anonym0use
Having recently gotten into test driven development I am using the Nunit test runner shipped as part of resharper. It has some downsides in terms of there is no shortcut to run tests and I have to go looking for the Nunit test runner to invoke it using the mouse. It has a nice GUI and shows the results as part of the IDE well.
最近进入测试驱动开发,我正在使用作为 resharper 一部分提供的 Nunit 测试运行器。它有一些缺点,因为没有运行测试的快捷方式,我必须去寻找 Nunit 测试运行器才能使用鼠标调用它。它有一个很好的 GUI,并且可以很好地将结果显示为 IDE 的一部分。
What do other people use for running unit tests against .net projects? I have googled other apps including MBUnit and the Unit test App from Nunit.org and wondered what comes out on top for people.
其他人使用什么来针对 .net 项目运行单元测试?我在谷歌上搜索了其他应用程序,包括 MBUnit 和来自 Nunit.org 的单元测试应用程序,并想知道对人们来说最重要的是什么。
采纳答案by mezoid
Resharper does have some shortcomings...but it is possible to configure it to do what you want...
Resharper 确实有一些缺点……但是可以对其进行配置以执行您想要的操作……
You can configure keyboard options in Visual Studio. Also, you can use the Unit Test Explorer in Resharper to find the tests you want and add them to the current session. I usually configure a shortcut (Alt+U) that runs all the tests in my current session...that way as I'm developing I can run all of the unit tests I need in seconds.
您可以在 Visual Studio 中配置键盘选项。此外,您可以使用 Resharper 中的单元测试资源管理器来查找您想要的测试并将它们添加到当前会话中。我通常配置一个快捷方式 (Alt+U) 来运行我当前会话中的所有测试……这样在我开发时,我可以在几秒钟内运行我需要的所有单元测试。
Also check out:
还请查看:
However, it would be nice if this didn't have to be manually configured! (Yes! I'm looking at you Resharper Dev team! LOL)
但是,如果不必手动配置,那就太好了!(是的!我在看你 Resharper 开发团队!大声笑)
回答by chrissie1
Resharper and I think there are shortcuts, but yes it has some shortcomings. Like no testcoverage like TestMatrixhas. But then life is not perfect anyway.
Resharper 和我认为有捷径可走,但是它有一些缺点。就像没有像TestMatrix这样的testcoverage一样。但无论如何,生活并不完美。
TestMatrix seems to b dead BTW.
顺便说一句,TestMatrix 似乎死了。
回答by DamianM
I've always been a fan of TestDriven.NET, I much prefer it over using ReSharper.
我一直是 TestDriven.NET 的粉丝,与使用 ReSharper 相比,我更喜欢它。
回答by Erik ?jebo
I use the separate NUnit GUI, that is shipped with NUnit. The down side is that you have to alt-tab to it, but I like the visual feedback of having a fat green/red bar across my screen, and having a good overview of all the tests in the treeview.
我使用单独的 NUnit GUI,它随 NUnit 一起提供。不利的一面是,您必须按 alt-tab 键才能看到它,但我喜欢屏幕上有一个绿色/红色粗条的视觉反馈,并且对树视图中的所有测试有一个很好的概述。
You can set it to rerun the last test run when it detects that the assembly was changed, so then it really does not slow you down that it is not integrated into Visual Studio.
您可以将其设置为在检测到程序集已更改时重新运行上次测试运行,因此它确实不会因为它没有集成到 Visual Studio 中而减慢您的速度。
回答by JoshRivers
Gallio Icarus is a much better looking test runner than the one included with nUnit. It runs nUnit tests, so it's worth a look.
Gallio Icarus 是一个比 nUnit 中包含的测试运行器更好看的测试运行器。它运行 nUnit 测试,所以值得一看。
回答by Adam Caviness
Overall I like the NUnit GUI but there are some annoyances I currently live with:
总的来说,我喜欢 NUnit GUI,但我目前有一些烦恼:
- auto-expansion of fixtures after running a test
- double-clicking a test clears the results of the peer tests
- 运行测试后自动扩展夹具
- 双击测试清除对等测试的结果
I also very much like the DevExpress Test Runner but it rebuilds my projects before running the tests. This wouldn't be a problem in a small system but when you have nearly 60 projects it's no small wait.
我也非常喜欢 DevExpress Test Runner,但它会在运行测试之前重建我的项目。这在小型系统中不会成为问题,但是当您有近 60 个项目时,等待时间可不短。
回答by seldary
I used to work with TestDriven.Net, which is IMHO the best runner out there, but lately NCrunchis my new favorite for unit testing.
我曾经与 TestDriven.Net 一起工作,恕我直言,这是最好的跑步者,但最近NCrunch是我最喜欢的单元测试。
NCrunch runs (selectively) all your tests in the background, as you code. It is a great tool for TDDing, with almost instant feedback upon code breaking. It also provides code coverage data, and performance metrics, with no effort on your part (but with your processor's devotion...).
NCrunch 在您编写代码时(有选择地)在后台运行您的所有测试。它是一个很棒的 TDDing 工具,几乎可以在代码破解时提供即时反馈。它还提供代码覆盖率数据和性能指标,而您无需付出任何努力(但需要您的处理器投入……)。
I still use TestDriven.Net for heavy integration tests (as I usually disable them in NCrunch), and specific tasks, so using both runners is a great combination for the TDD practitioner.
我仍然使用 TestDriven.Net 进行大量集成测试(因为我通常在 NCrunch 中禁用它们)和特定任务,因此对 TDD 从业者来说,使用这两个运行器是一个很好的组合。