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.
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
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
Declaration
public const int FILE_NOT_FOUND = -2
Field Value
View Source
INVALID_ARG
Declaration
public const int INVALID_ARG = -1
Field Value
View Source
INVALID_TEST_FIXTURE
Declaration
public const int INVALID_TEST_FIXTURE = -4
Field Value
View Source
OK
Declaration
Field Value
View Source
UNEXPECTED_ERROR
Unexpected error occurred
Declaration
public const int UNEXPECTED_ERROR = -100
Field Value
Properties
View Source
Summary
Declaration
public ResultSummary Summary { get; }
Property Value
Methods
View Source
CreateTestFilter(NUnitLiteOptions)
Create the test filter for this run - public for testing
Declaration
public static TestFilter CreateTestFilter(NUnitLiteOptions options)
Parameters
Returns
Type |
Description |
TestFilter |
|
View Source
Execute(ExtendedTextWriter, TextReader, string[])
Declaration
public int Execute(ExtendedTextWriter writer, TextReader reader, string[] args)
Parameters
Returns
View Source
Execute(string[])
Declaration
public int Execute(string[] args)
Parameters
Type |
Name |
Description |
string[] |
args |
|
Returns
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
Returns
View Source
ReportResults(ITestResult)
Declaration
public void ReportResults(ITestResult result)
Parameters
View Source
RunTests(TestFilter, IDictionary<string, object>)
Declaration
public int RunTests(TestFilter filter, IDictionary<string, object> runSettings)
Parameters
Returns
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