Class AutoRun
The AutoRun class is used by executable test assemblies to control their own execution.
Call it from your executable test like this: new AutoRun().Execute(args); The arguments can be those passed into your exe or constructed for the purpose in your code.
If the tests are in a dll, you can write a stub executable that runs them like this: new Autorun().Execute(testAssembly, args);
When running tests compiled against the .NET Standard framework, the methods above are not available. Run your tests like this: new AutoRun().Execute(testAssembly, args, output, input); Where output is an ExtendedTextWriter (normally a ColorConsoleWriter) and input is usually Console.In and is used by the --wait option.
Inherited Members
Namespace: NUnitLite
Assembly: nunitlite.dll
Syntax
public class AutoRun
Constructors
View SourceAutoRun()
Default Constructor, only used where GetCallingAssembly is available
Declaration
public AutoRun()
AutoRun(Assembly)
Constructor for use where GetCallingAssembly is not available, requiring the assembly to be passed.
Declaration
public AutoRun(Assembly testAssembly)
Parameters
Type | Name | Description |
---|---|---|
Assembly | testAssembly | The test assembly |
Methods
View SourceExecute(string[])
Execute the tests in the assembly, passing in a list of arguments.
Declaration
public int Execute(string[] args)
Parameters
Type | Name | Description |
---|---|---|
string[] | args | arguments for NUnitLite to use |
Returns
Type | Description |
---|---|
int |
Execute(string[], ExtendedTextWriter, TextReader)
Execute the tests in the assembly, passing in a list of arguments, a test assembly a writer and a reader. For use in builds for runtimes that don't support Assembly.GetCallingAssembly().
Declaration
public int Execute(string[] args, ExtendedTextWriter writer, TextReader reader)
Parameters
Type | Name | Description |
---|---|---|
string[] | args | Arguments passed to NUnitLite |
ExtendedTextWriter | writer | An ExtendedTextWriter to which output will be written |
TextReader | reader | A TextReader used when waiting for input |
Returns
Type | Description |
---|---|
int |