microsoftly/BotTester

Send args with sendMessageToBot() ?

Opened this issue · 1 comments

Hello there, was wondering if there was any way to send arguments alongside the message with .sendMessageToBot();

something like the following:

const msg = {
    message: 'hello',
    args: { entities: ['bla1', 'bla2'], intents: 'test' }
}

.sendMessageToBot(msg, "Bot says hello to you too");

I am using args in my dialogs to handle logic

(session, args, next) => {
    if (args.something) {
        do something 
    }
    else {
        do something else
    }
}

Thank you.

I like the idea for testing particular dialogs, but I think it misses the main purpose of the framework.

The test framework is meant to be a programatic way of interacting with a bot. Any dialog should be reachable via sending an IMessage to the bot. If a particular dialog has args passed in, they can be populated by simulating a conversation upto that point or instantiating the bot with the conversation at that point.

If you want to test a single dialog, you would likely need to export it in such a way that it can be attached to a test bot and beginDialog or an equivalent could be used to start the dialog with the args you're looking for.

It also looks like you're trying to mock out an NLP service like luis.ai. You can use something like nock to mock the outbound requests and inbound responses. I started working on just that service but put it on hold due to time constraints during my day job. Check it out -> https://github.com/microsoftly/luis-mocker. I'd be more than happy to try to help guide you along if you're interested in contributing there.


as an aside, it could be possible to do what you're looking for and I'm not seeing a clear way right now. If you can propose an implementation that could do this in a sane way, I'd be happy to consider