Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pass parameters via the command line to NUnit

Is it somehow possible to pass values to NUnit tests via the command line?

My tests use a certain URL. I have different instances of my code at different URLs and would like to specify the URL via the command line. File App.config is not an option, because I want to run the tests for different URLs via a batch file.

like image 753
Achim Avatar asked Jul 06 '10 18:07

Achim


People also ask

How do I open console in NUnit?

In Visual Studio, from the Tools menu, select NuGet Package Manager | Manage NuGet packages for solution... Open the Browser tab, and Scroll or use search to locate the NUnit and NUnit. Console packages.


1 Answers

Use an environment variable to pass the information.

Use set from the command-line or <setenv> from NAnt. Then read the value using Environment.GetEnvironmentVariable().

like image 83
Brian Low Avatar answered Oct 01 '22 18:10

Brian Low