Can anyone please tell me how to run only failed test cases using NUnit.


NUnit does not provide this feature. There is no feature to re-run only the failed test cases.

Would can do is start only a couple of tests from the command-line by their name:

--test=NAMES Comma-separated list of NAMES of tests to run or explore. This option may be repeated. Note that this option is retained for backward compatibility. The --where option can now be used instead.

--testlist=FILE The name (or path) of a FILE containing a list of tests to run or explore, one per line.


Now to create the list of tests to re-run you should be able to extract the failed tests from the Test Result XML file, but again there is no example code, you will need to create it yourself. Should not be to complicated for an average programmer, ask local developers for help.


It's possible to write an engine extension (IResultWriter) that would save a list of failed tests one per line in the same format that NUnit uses to run tests from the "--testlist" option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.