This project is an example of how to develop a bot using bot framework and integrate unit testing into the project.
The tests include:
- Sending and testing received messages from the bot framework
- LUIS models mocking
npm test
npm start
Testing is done by adding /test/dialog-flows
like so:
module.exports = [
{
out: "set alarm in 10 seconds"
},
{
in: "What would you like to call your alarm?",
out: "test"
}
/* ... */
];
And adding a test via /test/index.js
;
describe('Bot Tests', () => {
it('help', function (done) {
var connector = new builder.ConsoleConnector();
var bot = testBot.create(connector);
common.testBot(bot, require('./dialog-flows/flow.js'), done);
});
});
- exact string:
in: "string to test"
- regular expression:
in: /^(starts with string)/i
- function:
in: (message, assert, callback) => { assert(message.text.length); callback(); }