Search Results for

    Show / Hide Table of Contents

    Class TextRunner

    TextRunner is a general purpose class that runs tests and outputs to a text-based user interface (TextUI).

    Call it from your Main like this: new TextRunner(textWriter).Execute(args); OR new TextUI().Execute(args); The provided TextWriter is used by default, unless the arguments to Execute override it using -out. The second form uses the Console, provided it exists on the platform.

    NOTE: When running on a platform without a Console, such as Windows Phone, the results will simply not appear if you fail to specify a file in the call itself or as an option.

    Inheritance
    object
    TextRunner
    Implements
    ITestListener
    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 TextRunner : ITestListener

    Constructors

    View Source

    TextRunner()

    Initializes a new instance of the TextRunner class without specifying an assembly. This is interpreted as allowing a single input file in the argument list to Execute().

    Declaration
    public TextRunner()
    View Source

    TextRunner(Assembly)

    Initializes a new instance of the TextRunner class specifying a test assembly whose tests are to be run.

    Declaration
    public TextRunner(Assembly testAssembly)
    Parameters
    Type Name Description
    Assembly testAssembly

    Fields

    View Source

    FILE_NOT_FOUND

    File not found

    Declaration
    public const int FILE_NOT_FOUND = -2
    Field Value
    Type Description
    int
    View Source

    INVALID_ARG

    Invalid Arguments

    Declaration
    public const int INVALID_ARG = -1
    Field Value
    Type Description
    int
    View Source

    INVALID_TEST_FIXTURE

    Invalid test suite

    Declaration
    public const int INVALID_TEST_FIXTURE = -4
    Field Value
    Type Description
    int
    View Source

    OK

    OK

    Declaration
    public const int OK = 0
    Field Value
    Type Description
    int
    View Source

    UNEXPECTED_ERROR

    Unexpected error occurred

    Declaration
    public const int UNEXPECTED_ERROR = -100
    Field Value
    Type Description
    int

    Properties

    View Source

    Summary

    Declaration
    public ResultSummary Summary { get; }
    Property Value
    Type Description
    ResultSummary

    Methods

    View Source

    CreateTestFilter(NUnitLiteOptions)

    Create the test filter for this run - public for testing

    Declaration
    public static TestFilter CreateTestFilter(NUnitLiteOptions options)
    Parameters
    Type Name Description
    NUnitLiteOptions options
    Returns
    Type Description
    TestFilter
    View Source

    Execute(ExtendedTextWriter, TextReader, string[])

    Declaration
    public int Execute(ExtendedTextWriter writer, TextReader reader, string[] args)
    Parameters
    Type Name Description
    ExtendedTextWriter writer
    TextReader reader
    string[] args
    Returns
    Type Description
    int
    View Source

    Execute(string[])

    Declaration
    public int Execute(string[] args)
    Parameters
    Type Name Description
    string[] args
    Returns
    Type Description
    int
    View Source

    MakeRunSettings(NUnitLiteOptions)

    Make the settings for this run - this is public for testing

    Declaration
    public static Dictionary<string, object> MakeRunSettings(NUnitLiteOptions options)
    Parameters
    Type Name Description
    NUnitLiteOptions options
    Returns
    Type Description
    Dictionary<string, object>
    View Source

    ReportResults(ITestResult)

    Declaration
    public void ReportResults(ITestResult result)
    Parameters
    Type Name Description
    ITestResult result
    View Source

    RunTests(TestFilter, IDictionary<string, object>)

    Declaration
    public int RunTests(TestFilter filter, IDictionary<string, object> runSettings)
    Parameters
    Type Name Description
    TestFilter filter
    IDictionary<string, object> runSettings
    Returns
    Type Description
    int
    View Source

    SendMessage(TestMessage)

    Called when a test produces a message to be sent to listeners

    Declaration
    public void SendMessage(TestMessage message)
    Parameters
    Type Name Description
    TestMessage message

    A TestMessage object containing the text to send

    View Source

    TestFinished(ITestResult)

    Called when a test has finished

    Declaration
    public void TestFinished(ITestResult result)
    Parameters
    Type Name Description
    ITestResult result

    The result of the test

    View Source

    TestOutput(TestOutput)

    Called when a test produces output for immediate display

    Declaration
    public void TestOutput(TestOutput output)
    Parameters
    Type Name Description
    TestOutput output

    A TestOutput object containing the text to display

    View Source

    TestStarted(ITest)

    Called when a test or suite has just started

    Declaration
    public void TestStarted(ITest test)
    Parameters
    Type Name Description
    ITest test

    The test that is starting

    Implements

    ITestListener
    • 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