TestingStarted Event

Occurs when this instance starts tests running. This event is fired from an arbitrary thread.

Type: Runner

Namespace: XJTAG.Integration.XJRunner

Syntax

public event EventHandler TestingStarted

Remarks

This event is fired from the thread on which the test code is running. You therefore need to be careful about synchronising access to your data structures and, if your code accesses any user interface controls, you will need to use BeginInvoke to ensure that you access methods and properties from the appropriate thread.

Example

In this example we show how to disable a Windows.Forms.Button control upon testing beginning, using the TestingStarted event.

class Testing
{
    Runner runner;
    TestCollection testList;

    Button runButton;

    void InitialiseRunner()
    {
        /*
         * ...
         * Code to obtain Runner object from project and get test list.
         * ...
         */

        // Subscribe to TestingStarted event.
        runner.TestingStarted += runner_TestingStarted;
    }

    void runner_TestingStarted(object sender, EventArgs e)
    {
        // Whenever and whereever testing is started on 'runner' this method will be executed
        // and the runButton disabled.

        runButton.Enabled = false;
    }
}