Class TestInstructionExecutor
Handles execution of test instructions, external result sources, and failure notifications.
Implements
Namespace: Responsible
Assembly: Responsible.dll
Syntax
[PublicAPI]
public class TestInstructionExecutor : IDisposable
Remarks
It is recommended to use a base class for your tests using Responsible, which sets up and disposes the test instruction executor.
Constructors
TestInstructionExecutor(ITestScheduler, IExternalResultSource, IFailureListener, IGlobalContextProvider, IReadOnlyList<Type>)
Constructs a new test instruction executor.
Declaration
public TestInstructionExecutor(ITestScheduler scheduler, IExternalResultSource externalResultSource = null, IFailureListener failureListener = null, IGlobalContextProvider globalContextProvider = null, IReadOnlyList<Type> rethrowableExceptions = null)
Parameters
Type | Name | Description |
---|---|---|
ITestScheduler | scheduler | Implementation for time and frame based operations. |
IExternalResultSource | externalResultSource | Optional source for premature completion of test operations. |
IFailureListener | failureListener | Optional failure listener, to get notifications on test operation failures. |
IGlobalContextProvider | globalContextProvider | Optional provider for global context, which gets included in failure messages. |
IReadOnlyList<Type> | rethrowableExceptions | Optional collection of exception types to rethrow, instead of wrapping them in
TestFailureException.
Test instructions terminating with any of the given exception types will be considered
completed, and not failed. Can be used with e.g. NUnit's |
Methods
Dispose()
Disposes the executor. For extra safety, it is recommended to construct a new executor for each test, and dispose it after the test has finished.
Declaration
public virtual void Dispose()
SubscribeToStates(TestInstructionExecutor.StateNotificationCallback)
Will call callback
when operations start or finish.
Declaration
public static IDisposable SubscribeToStates(TestInstructionExecutor.StateNotificationCallback callback)
Parameters
Type | Name | Description |
---|---|---|
TestInstructionExecutor.StateNotificationCallback | callback | Callback to call when an operation starts or finishes. |
Returns
Type | Description |
---|---|
IDisposable | A disposable, which will remove the callback when disposed. |
Remarks
Static, so that Unity EditorWindows can access it. Used by the test operation window available in Unity at Window/Responsible/Operation State.