• Home
  • .NET
  • Unity
  • Godot
  • Design Overview
  • API Documentation
  • Changelog
  • GitHub
Show / Hide Table of Contents
  • Responsible
    • BddExtensions
    • IExternalResultSource
    • IFailureListener
    • IGlobalContextProvider
    • IOptionalTestResponder
    • ITestInstruction<T>
    • ITestOperation<T>
    • ITestResponder<T>
    • ITestScheduler
    • ITestWaitCondition<T>
    • LinqSupport
    • OptionalTestResponder
    • RepetitionLimitExceededException
    • Responsibly
    • TestFailureException
    • TestInstruction
    • TestInstructionExecutor
    • TestInstructionExecutor.StateNotificationCallback
    • TestOperationState
    • TestResponder
    • TestWaitCondition
  • Responsible.Bdd
    • IBddStep
    • Keywords
    • ScenarioBuilder
  • Responsible.Context
    • RunContext
  • Responsible.Docs
    • Inherit
  • Responsible.State
    • ITestOperationState
    • ITestOperationState<T>
    • StateStringBuilder
    • TestOperationStateTransition
    • TestOperationStatus
  • Responsible.Unity
    • TestOperationYieldInstruction<T>
    • UnhandledLogMessageException
    • UnityErrorLogInterceptor
    • UnityFailureListener
    • UnityTestInstructionExecutor
    • UnityTestScheduler
  • Responsible.Utilities
    • IMultipleTaskAwaiter<T>
    • IMultipleTaskSource<T>
    • IndentedStringBuilder<T>
    • RetryingPoller

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
Inheritance
object
TestInstructionExecutor
UnityTestInstructionExecutor
Implements
IDisposable
Inherited Members
TestInstructionExecutor.SubscribeToStates(TestInstructionExecutor.StateNotificationCallback)
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
TestInstructionExecutor.Dispose()

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

Implements

IDisposable

Extension Methods

BddExtensions.RunScenario(TestInstructionExecutor, ScenarioBuilder, params IBddStep[])
In this article
Back to top Generated by DocFX