tock / ai.tock.bot.test.junit / TockJUnit5ExtensionBase

# TockJUnit5ExtensionBase

`open class TockJUnit5ExtensionBase<out T : TestContext>` (source)

JUnit5 base extension.

### Constructors

#### <init> | JUnit5 base extension. `TockJUnit5ExtensionBase(botDefinition: BotDefinition, lifecycle: TestLifecycle<T> = TestLifecycle(TestContext() as T))`

### Properties

#### botDefinition | `val botDefinition: BotDefinition`
#### lifecycle | `val lifecycle: TestLifecycle<T>`
#### testContext | The TestContext. `val testContext: T`

### Functions

#### afterEach | `open fun afterEach(context: <ERROR CLASS>): Unit`
#### beforeEach | `open fun beforeEach(context: <ERROR CLASS>): Unit`
#### busMock | Provides a mock context initialized with the current testContext. `fun busMock(): BotBusMock`
#### newBusMock | Provides a mock initialized with the specified StoryDefinition. `fun newBusMock(story: StoryDefinition = testContext.defaultStoryDefinition(botDefinition), connectorType: ConnectorType = testContext.defaultConnectorType(), locale: Locale = testContext.defaultLocale(), userId: PlayerId = testContext.defaultPlayerId()): BotBusMock`
#### newBusMockContext | Provides a mock context initialized with the specified StoryDefinition. `fun newBusMockContext(story: StoryDefinition = testContext.defaultStoryDefinition(botDefinition), connectorType: ConnectorType = testContext.defaultConnectorType(), locale: Locale = testContext.defaultLocale(), userId: PlayerId = testContext.defaultPlayerId(), botId: PlayerId = PlayerId("bot", PlayerType.bot), action: Action = SendSentence(userId, botDefinition.botId, botId, ""), userInterfaceType: UserInterfaceType = UserInterfaceType.textChat, userPreferences: UserPreferences = UserPreferences(locale = locale)): BotBusMockContext`
#### newChoiceRequest | Creates a new choice request (not yet sent). `fun newChoiceRequest(intent: IntentAware = testContext.defaultStoryDefinition(botDefinition), parameters: Parameters, connectorType: ConnectorType = testContext.defaultConnectorType(), userInterfaceType: UserInterfaceType = connectorType.userInterfaceType, locale: Locale = testContext.defaultLocale(), userId: PlayerId = testContext.defaultPlayerId(), botId: PlayerId = PlayerId("bot", PlayerType.bot), userPreferences: UserPreferences = UserPreferences(locale = locale), tests: BotBusMock.() -> Unit): Unit`
#### newRequest | Creates a new sentence request (not yet sent). `fun newRequest(text: String = "", intent: IntentAware = testContext.defaultStoryDefinition(botDefinition), vararg entities: EntityValue, connectorType: ConnectorType = testContext.defaultConnectorType(), userInterfaceType: UserInterfaceType = connectorType.userInterfaceType, locale: Locale = testContext.defaultLocale(), userId: PlayerId = testContext.defaultPlayerId(), botId: PlayerId = PlayerId("bot", PlayerType.bot), userPreferences: UserPreferences = UserPreferences(locale = locale), tests: BotBusMock.() -> Unit): Unit` Creates a new action request (not yet sent). `fun newRequest(intent: IntentAware = testContext.defaultStoryDefinition(botDefinition), connectorType: ConnectorType = testContext.defaultConnectorType(), userInterfaceType: UserInterfaceType = connectorType.userInterfaceType, locale: Locale = testContext.defaultLocale(), userId: PlayerId = testContext.defaultPlayerId(), botId: PlayerId = PlayerId("bot", PlayerType.bot), userPreferences: UserPreferences = UserPreferences(locale = locale), actionProvider: () -> Action, tests: BotBusMock.() -> Unit): Unit`
#### selectChoice | Sends a message simulating a click on action of a previous bus log and execute the tests. `fun selectChoice(busMockLog: BotBusMockLog, buttonTitle: String, tests: BotBusMock.() -> Unit): BotBusMock`
#### selectElementChoice | Sends a message simulating a click on action of an element in previous bus log and execute the tests. `fun selectElementChoice(busMockLog: BotBusMockLog, elementIndex: Int, buttonTitle: String, tests: BotBusMock.() -> Unit): BotBusMock`
#### send | Sends a sentence and execute the tests. `fun send(text: String = "", intent: IntentAware = testContext.defaultStoryDefinition(botDefinition), vararg entities: EntityValue, connectorType: ConnectorType = testContext.defaultConnectorType(), userInterfaceType: UserInterfaceType = connectorType.userInterfaceType, locale: Locale = testContext.defaultLocale(), userId: PlayerId = testContext.defaultPlayerId(), botId: PlayerId = PlayerId("bot", PlayerType.bot), userPreferences: UserPreferences = UserPreferences(locale = locale), metadata: ActionMetadata = ActionMetadata(), tests: BotBusMock.() -> Unit): BotBusMock` Sends an action and execute the tests. `fun send(intent: IntentAware = testContext.defaultStoryDefinition(botDefinition), connectorType: ConnectorType = testContext.defaultConnectorType(), userInterfaceType: UserInterfaceType = connectorType.userInterfaceType, locale: Locale = testContext.defaultLocale(), userId: PlayerId = testContext.defaultPlayerId(), botId: PlayerId = PlayerId("bot", PlayerType.bot), userPreferences: UserPreferences = UserPreferences(locale = locale), actionProvider: () -> Action, tests: BotBusMock.() -> Unit): BotBusMock`
#### sendChoice | Sends a choice and execute the tests. `fun sendChoice(intent: IntentAware = testContext.defaultStoryDefinition(botDefinition), parameters: Parameters = Parameters(), connectorType: ConnectorType = testContext.defaultConnectorType(), userInterfaceType: UserInterfaceType = connectorType.userInterfaceType, locale: Locale = testContext.defaultLocale(), userId: PlayerId = testContext.defaultPlayerId(), botId: PlayerId = PlayerId("bot", PlayerType.bot), userPreferences: UserPreferences = UserPreferences(locale = locale), tests: BotBusMock.() -> Unit): BotBusMock`
#### sendMessage | Sends a message and execute the tests. `fun sendMessage(intent: IntentAware = testContext.defaultStoryDefinition(botDefinition), message: Message, connectorType: ConnectorType = testContext.defaultConnectorType(), userInterfaceType: UserInterfaceType = connectorType.userInterfaceType, locale: Locale = testContext.defaultLocale(), userId: PlayerId = testContext.defaultPlayerId(), botId: PlayerId = PlayerId("bot", PlayerType.bot), userPreferences: UserPreferences = UserPreferences(locale = locale), tests: BotBusMock.() -> Unit): BotBusMock`
#### startBusMock | Provides a mock context initialized with the current testContext and runs the bus. `fun startBusMock(): BotBusMock`
#### startNewBusMock | Provides a mock initialized with the specified StoryDefinition and starts the story. `fun startNewBusMock(story: StoryDefinition = testContext.defaultStoryDefinition(botDefinition), connectorType: ConnectorType = testContext.defaultConnectorType(), locale: Locale = testContext.defaultLocale(), userId: PlayerId = testContext.defaultPlayerId()): BotBusMock`

### Inheritors

#### TockJUnit5Extension | JUnit5 extension. `open class TockJUnit5Extension : TockJUnit5ExtensionBase<TestContext>`