IEventListener
Overview
IEventListener is an interface that can react on events that occurs during test run.
This interface is used by the Runner class to notify about events.
Use case
You can create a class that implements this interface to be able to react on test run events:
type
MyListener = public class (IEventListener)
public
method RunFinished(TestResult: ITestResult); empty;
method TestFinished(TestResult: ITestResult);
method TestStarted(Test: ITest);
method RunStarted(Test: ITest); empty;
end;
implementation
method MyListener.TestStarted(Test: ITest);
begin
writeLn("Testing: " + Test.Name);
end;
method MyListener.TestFinished(TestResult: ITestResult);
begin
writeLn("Tested: " + TestResult.Name);
end;
//Starting test run
var lTests := Discovery.DiscoverTests();
Runner.RunTests(lTests) withListener(new MyListener);
Location
-
Reference:
- RemObjects.Elements.EUnit.dll .NET, .NET Standard 2.0
- remobjects.elements.eunit.jar Cooper
- EUnit.fx Island, macOS
- libEUnit.fx Toffee
- Namespace: RemObjects.Elements.EUnit
- Platforms: .NET, .NET Standard 2.0, Cooper, Island, macOS, Toffee
Required Methods
RunFinished
Called when test run is finished.
method RunFinished(TestResult: ITestResult)
void RunFinished(ITestResult TestResult)
func RunFinished(_ TestResult: ITestResult)
void RunFinished(ITestResult TestResult)
Sub RunFinished(TestResult As ITestResult)
Parameters:
- TestResult: Reference to a root test result item.
RunStarted
Called when test run is started by the runner.
method RunStarted(Test: ITest)
void RunStarted(ITest Test)
func RunStarted(_ Test: ITest)
void RunStarted(ITest Test)
Sub RunStarted(Test As ITest)
Parameters:
- Test: Reference to a test root.
TestFinished
Called when test is finished.
method TestFinished(TestResult: ITestResult)
void TestFinished(ITestResult TestResult)
func TestFinished(_ TestResult: ITestResult)
void TestFinished(ITestResult TestResult)
Sub TestFinished(TestResult As ITestResult)
Parameters:
- TestResult: Reference to a test result of a finished test.
TestStarted
Called when test is started.
method TestStarted(Test: ITest)
void TestStarted(ITest Test)
func TestStarted(_ Test: ITest)
void TestStarted(ITest Test)
Sub TestStarted(Test As ITest)
Parameters:
- Test: Reference to a test that was started.