Search code examples
automated-testschatbotbotium-box

Botium - handle different set of responses


With Botium will I able to handle different set of responses ? I mean different count.

Sometimes i get two responses, some time i get only a single response for the same input text. The chat bot will return two responses in case of success and one single response during failure.

If I always get one response, but only the response value going to be different, the I can use utterances file to add all those varied responses.

But if the count itself is going to be different, how can i handle it ?


Solution

  • These are two different test cases and should be handled as such - two different convos. From a test automation perspective, when following a given transcript with the chatbot, it is not possible to decide if the transcript should continue or it should wait for an additional response.

    For example:

    #me
    hello bot
    
    #bot
    hello
    
    #bot
    how are you
    
    #me
    please tell me the weather
    

    If the bot sometimes sends the "how are you" and sometimes it doesn't, how should Botium know when it should continue with the "please tell me the weather" ? Should it wait two seconds for the "how are you" ? Or should it wait eight seconds for another response before conversation continues ?

    UPDATE 20.03.2020

    You cannot do what you want with the Fluent interface, but with the async BotiumDriver API it is possible (turn function is just sending text and receiving an answer).

    const driver = new BotDriver()
    const container = await driver.Build()
    await container.Start()
    
    let answer = await turn(container, "order number 1")
    if (answer.startsWith("here are the details for order")) {
      await turn(container, "thank you")
    } else {
      await turn(container, "thanks for nothing")
    }
    

    As a showcase how to handle this with Botium Core, here is some sample code: https://repl.it/@FlorianTreml/replit-botium-bindings-albie-1