How to Running all tests 2 times with Nunit

159 Views Asked by At

i want to run all tests 1 time. One method will run after all tests are finished. This test will change the language of the application. How can I start all tests from scratch?

1

There are 1 best solutions below

0
On

If you want all tests for one language to run and complete before the second run begins, this is best done outside of NUnit in the script that runs your tests. Just run NUnit twice, passing the language to it as a parameter each time through the --testparm option, e.g. --testparam lang=en-US.

In your test code, use a global OneTimeSetUp to read the parameter value and then set the language for the rest of the run. Using the above example, you would access the language parameter using TestContext.TestParameters["lang"]`.

Note that there are other ways to do this if you don't require the tests for one language to complete before the next set starts.