Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I make NUnit execute tests in random order?

Greetings, I would like to make NUnit execute my unit tests in a random order every time in order to ensure they are isolated and FIRST. Does anyone know of a easy way to do this well without branching NUnit?

like image 838
ryber Avatar asked Sep 21 '09 13:09

ryber


People also ask

How does NUnit decide what order to run tests in?

There is no facility in NUnit to order tests globally. Tests with an OrderAttribute argument are started before any tests without the attribute. Ordered tests are started in ascending order of the order argument. Among tests with the same order value or without the attribute, execution order is indeterminate.

Does NUnit run tests in parallel by default?

The NUnit 3.0 framework can run tests in parallel within an assembly. This is a completely separate facility from Engine Parallel Test Execution, although it is possible to use both in the same test run. By default, no parallel execution takes place.

What is the use of order attribute in NUnit?

To order tests explicitly, NUnit provides an OrderAttribute . Tests with this attribute are started before tests without. The order value is used to determine the order to run the unit tests.


1 Answers

There looks to be an nUnit add-in for this: http://www.nablasoft.com/alkampfer/index.php/2008/12/06/randomizer-nunit-addin/

like image 177
Matt Poush Avatar answered Sep 29 '22 11:09

Matt Poush