Search Results for

    Show / Hide Table of Contents

    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.

    Inheritance
    object
    AutoRun
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: NUnitLite
    Assembly: nunitlite.dll
    Syntax
    public class AutoRun

    Constructors

    View Source

    AutoRun()

    Default Constructor, only used where GetCallingAssembly is available

    Declaration
    public AutoRun()
    View Source

    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 Source

    Execute(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
    View Source

    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
    • View Source
    In this article
    Back to top Generated by DocFX | Copyright (c) 2018- The NUnit Project - Licensed under CC BY-NC-SA 4.0