Düzenle

Aracılığıyla paylaş


TouchRunner Class

Definition

The TouchRunner type is the main class for Touch.Unit. With a few settings it will create it's own UI and can start (by user input or automatically) executing all unit tests that were added to the runner's instance.

public class TouchRunner : MonoTouch.NUnit.UI.BaseTouchRunner
type TouchRunner = class
    inherit BaseTouchRunner
Inheritance
TouchRunner

Remarks

By default all logs will be displayed on the console, i.e. they will be shown in MonoDevelop's Application Output pad.

// a common FinishedLaunching implementation to use Touch.Unit inside a project
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
    window = new UIWindow (UIScreen.MainScreen.Bounds);
    runner = new TouchRunner (window);
    // register every tests included in the main application/assembly
    runner.Add (System.Reflection.Assembly.GetExecutingAssembly ());
    window.RootViewController = new UINavigationController (runner.GetViewController ());
    window.MakeKeyAndVisible ();
    return true;
}

Logs can also be sent to a network server, e.g. for automated testing.

// a FinishedLaunching implementation to use the automated testing features
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
    window = new UIWindow (UIScreen.MainScreen.Bounds);
    runner = new TouchRunner (window);
    // register every tests included in the main application/assembly
    runner.Add (System.Reflection.Assembly.GetExecutingAssembly ());
    // you can use a TcpTextWriter or set your own custom writer
    runner.Writer = new TcpTextWriter ("10.0.1.2", 16384);
    // start running the test suites as soon as the application is loaded
    runner.AutoStart = true;
    // crash the application (to ensure it's ended) and return to springboard
    runner.TerminateAfterExecution = true;
    window.RootViewController = new UINavigationController (runner.GetViewController ());
    window.MakeKeyAndVisible ();
    return true;
}

Constructors

TouchRunner(UIWindow)

Properties

AutoStart (Inherited from BaseTouchRunner)
FailedCount (Inherited from BaseTouchRunner)
Filter (Inherited from BaseTouchRunner)
IgnoredCount (Inherited from BaseTouchRunner)
InconclusiveCount (Inherited from BaseTouchRunner)
LoadedTest (Inherited from BaseTouchRunner)
NavigationController

Helper property that gets the RootViewController property of the UIWindow that was provided to the constructor.

PassedCount (Inherited from BaseTouchRunner)
Result (Inherited from BaseTouchRunner)
Suite (Inherited from BaseTouchRunner)
TerminateAfterExecution (Inherited from BaseTouchRunner)
TestCount (Inherited from BaseTouchRunner)
Writer (Inherited from BaseTouchRunner)

Methods

Add(Assembly, IList<String>) (Inherited from BaseTouchRunner)
Add(Assembly) (Inherited from BaseTouchRunner)
AutoRun() (Inherited from BaseTouchRunner)
CloseWriter() (Inherited from BaseTouchRunner)
ExecuteOnMainThread(Action)
GetViewController()
Load(Assembly, IDictionary) (Inherited from BaseTouchRunner)
Load(String, IDictionary) (Inherited from BaseTouchRunner)
LoadSync() (Inherited from BaseTouchRunner)
OpenWriter(String) (Inherited from BaseTouchRunner)
Run() (Inherited from BaseTouchRunner)
Run(Test) (Inherited from BaseTouchRunner)
Show(TestSuite)
TerminateWithSuccess()
TestFinished(ITestResult)
TestOutput(TestOutput) (Inherited from BaseTouchRunner)
TestStarted(ITest) (Inherited from BaseTouchRunner)
WriteDeviceInformation(TextWriter)

Applies to