What is the best Nunit test runner out there?

2019-02-01 19:51发布

问题:

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.

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.

回答1:

Resharper does have some shortcomings...but it is possible to configure it to do what you want...

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.

Also check out:

  • ReSharper run all unit tests in a project or solution at once

  • Are there shortcut keys for ReSharper's Unit Test Runner?

However, it would be nice if this didn't have to be manually configured! (Yes! I'm looking at you Resharper Dev team! LOL)



回答2:

I've always been a fan of TestDriven.NET, I much prefer it over using ReSharper.



回答3:

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.

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.



回答4:

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.



回答5:

I used to work with TestDriven.Net, which is IMHO the best runner out there, but lately NCrunch is my new favorite for unit testing.

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...).

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.



回答6:

Overall I like the NUnit GUI but there are some annoyances I currently live with:

  • 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.



回答7:

Resharper and I think there are shortcuts, but yes it has some shortcomings. Like no testcoverage like TestMatrix has. But then life is not perfect anyway.

TestMatrix seems to b dead BTW.