C# – How to execute NUnit test cases from command prompt

automationcnunit

How can I execute a test case from Command Console using NUnit? I had set of Selenium Tests written in C# based on NUnit framework. I need to execute the test cases simply by running from command console.

In JUnit we can run test case from cmd as

java junit.swingui.TestRunner test.Run

How can we do above in NUnit?

Best Answer

Use nunit-console.exe to run tests from the command line.

For example:

nunit-console.exe /xml:results.xml path/to/test/assembly.dll

This will run the unit tests and save the results in the results.xml file, which you can work with easily.

See the documentation for all of the various command line switches that are available.

Related Topic