Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IBotTester

Test builder/runner suite. After any of these are called, no functions in IConfigModified should be accessible

Hierarchy

  • IBotTester

Implemented by

Index

Methods

checkSession

  • loads a session associated with an address and passes it to a user defined function

    Parameters

    • sessionCheckerFunction: checkSessionFunction

      function passed in to inspect message

    • Optional address: IAddress

      (Optional) address of the session to load. Defaults to bot's default address if not defined

    Returns IBotTester

runTest

  • runTest(): Promise<__type>
  • executes each test step serially.

    Returns Promise<__type>

sendMessageToBot

  • sendMessageToBot(msg: IMessage | string, ...expectedResponses: (string | RegExp | IEvent | IMessage | (string | RegExp | IEvent | IMessage)[])[]): IBotTester
  • sends a message to a bot and compares bot responses against expectedResponsess. Expected responses can be a variable number of args, each of which can be a single expected response of any PossibleExpectedMessageType or a collection of PossibleExpectedMessageType that mocks a randomly selected response by the bot

    Parameters

    • msg: IMessage | string

      message to send to bot

    • Rest ...expectedResponses: (string | RegExp | IEvent | IMessage | (string | RegExp | IEvent | IMessage)[])[]

      (Optional) responses the bot-tester framework checks against

    Returns IBotTester

sendMessageToBotAndExpectSaveWithNoResponse

  • sendMessageToBotAndExpectSaveWithNoResponse(msg: IMessage | string): IBotTester
  • sends a message to the bot. This should be used whenever session.save() is used without sending a reply to the user. This exists due to a limitation in the current implementation of the botbuilder framework

    Parameters

    • msg: IMessage | string

      message to send to bot

    Returns IBotTester

sendMessageToBotIgnoringResponseOrder

  • sendMessageToBotIgnoringResponseOrder(msg: IMessage | string, ...expectedResponses: (string | RegExp | IEvent | IMessage | (string | RegExp | IEvent | IMessage)[])[]): IBotTester
  • same as sendMessageToBot, but the order of responses is not checked. This will cause the test to hang until all messages it expects are returned

    Parameters

    • msg: IMessage | string
    • Rest ...expectedResponses: (string | RegExp | IEvent | IMessage | (string | RegExp | IEvent | IMessage)[])[]

    Returns IBotTester

then

  • Works exactly like Promise's .then function, except that the return value is not passed as an arg to the next function (even if its another .then)

    Parameters

    • fn: Function

      some function to run

    Returns IBotTester

wait

  • Waits for the given delay between test steps.

    Parameters

    • delayInMilliseconds: number

    Returns IBotTester