Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to test my own dialogs in botbuilder-unit? #5

Open
rjgmail88 opened this issue Mar 16, 2018 · 6 comments
Open

How to test my own dialogs in botbuilder-unit? #5

rjgmail88 opened this issue Mar 16, 2018 · 6 comments
Assignees
Labels

Comments

@rjgmail88
Copy link

Hello,
I am looking at timmy.js where I see in order to test conversation flow mentioned in script array a new dialog '/' has been defined. I was wondering what if I need to test my dialog from my Bot app.
Ex: I have following dialog which triggers by LUIS intent help/

bot.dialog('Help', function (session) {
       session.send("Hello, I can help you to reserve a meeting room.")
        });
        session.endDialog();
    }).triggerAction({
        matches: 'Help'
    });

I don't want re-write this dialog as shows in timmy.js.

@gudwin gudwin self-assigned this Mar 16, 2018
@gudwin
Copy link
Owner

gudwin commented Mar 17, 2018

Hi,
What do you mean by saying "re-writing the dialog"?

You can test a standalone dialog by specifying a dialog function or a watterfall in the form of array. The library produce a UniversalBot class instance and registers the given dialog with path = "/"

Also you could pass an instance of UniversalBot class. In that case, the library will not produce a testing bot instance. This option also allows to test conversation between user and the bot from end to end

best regards,

@rjgmail88
Copy link
Author

What did I mean 're-writing the dialog'
In timmy.js in order to test bot's following responses dialog dialog('/') has been written in as follows.
"bot": "How should I call you?"
"bot": "Nice to meet you, "Timmy"!"

bot.dialog('/', [
  session => builder.Prompts.text(session, 'How should I call you?'),
  (session, response) => session.endDialog(`Nice to meet you, ${JSON.stringify(response.response)}!`)
]);

What am I asking ?
How can I test Help dialog mentioned in my original post in my test case. Do I need to re-write the dialog in test case file ?

@gudwin
Copy link
Owner

gudwin commented Mar 18, 2018

no, you don't no need to re-write, you could pass the same dialog

@rjgmail88
Copy link
Author

Is there a way you can help with the syntax.

@rjgmail88
Copy link
Author

@gudwin did you get chance to review my comment?

@gudwin
Copy link
Owner

gudwin commented Mar 21, 2018

Yeah, I'm adding your case as example into the library. I'll commit a release soon and will leave comment here too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants