Class UnityTestInstructionExecutor
A TestInstructionExecutor implementation that should work well in Unity:
- Polls on every frame
- Causes test operations to fail on logged errors
- Can also log failures, as Unity will swallow exceptions in nested coroutines
Implements
Inherited Members
Namespace: Responsible.Unity
Assembly: Responsible.dll
Syntax
public class UnityTestInstructionExecutor : TestInstructionExecutor, IDisposable
Remarks
Remember to dispose all instances of this class which you create!
Constructors
UnityTestInstructionExecutor(bool, IGlobalContextProvider)
Constructs a new TestInstructionExecutor with a default Unity configuration. If you are not using Responsible all the way, but also have some bare coroutines involved, you will probably want to also log any errors, in addition to failing the tests the normal way, as Unity has the tendency to swallow exceptions from nested coroutines.
Declaration
public UnityTestInstructionExecutor(bool logErrors = true, IGlobalContextProvider globalContextProvider = null)
Parameters
Type | Name | Description |
---|---|---|
bool | logErrors | Whether or not errors should be logged in addition to propagated. |
IGlobalContextProvider | globalContextProvider | Optional provider for global context, which gets included in failure messages. |
Methods
Dispose()
Disposes this executor, so that no more polling or log intercepting is done.
Declaration
public override void Dispose()
Overrides
ExpectLog(LogType, Regex)
Similar to Expect(LogType, Regex), but must be used instead of that, for Responsible to be able to successfully ignore errors. See also UnityErrorLogInterceptor. UnityEngine.TestTools.LogAssert.ignoreFailingMessages is respected
Declaration
public void ExpectLog(LogType logType, Regex regex)
Parameters
Type | Name | Description |
---|---|---|
LogType | logType | Log type to expect |
Regex | regex | Regular expression to match in the expected message |