Skip to content

Test dialogs independently #68

Open

Description

@ihachani

Is there a way to test Library without having to create a bot around it?

https://docs.botframework.com/en-us/node/builder/chat-reference/classes/_botbuilder_d_.library.html

Activity

  1. microsoftly commented on Feb 22, 2018

    @microsoftly
    Owner

    No, the framework requires a bot through which it can send and receive messages. You can make a simple bot that allows full logical and code coverage for your library though and test through that.

  2. ihachani commented on Feb 24, 2018

    @ihachani
    Author

    Can some one add this? That would save some effort.

  3. microsoftly commented on Feb 24, 2018

    @microsoftly
    Owner

    Now that you mention it, this seems like it may be a useful feature. It would also be cool to setup mock data to preload with. So something like

    new BotTester(bot)
        .WithDialog(dialog, <something here to set mock state when dialog starts>)
        .WithMiddleware(middleware)

    Would you be interested in helping design the feature &/or the implementation?

  4. ihachani commented on Feb 26, 2018

    @ihachani
    Author

    What I did to test the library was create a Bot then mapped the library default Dialog to the bot default Dialog.

    let bot = new botbuilder.UniversalBot(new TestConnector());
    let library = CustomLibrary.createLibrary();
    bot.library(library);
    bot.dialog('/', library.dialog('/'));

    I am thinking something like this will be helpful:

    new BotTester(bot)
        .WithDialog(['/',library.dialog('/')],['greeting', anotherDialog]);
  5. changed the title [-]Test Dialogue Library[/-] [+]Test dialogs independently[/+] on Feb 26, 2018
  6. microsoftly commented on Feb 26, 2018

    @microsoftly
    Owner

    I think that would be a great addition. Would you be interested in being a contributor? It will help shape the library towards your needs.

  7. ihachani commented on Feb 27, 2018

    @ihachani
    Author

    I will give it a try. Do you have some guidelines?

  8. microsoftly commented on Feb 27, 2018

    @microsoftly
    Owner
    • follow the linter as closely as you can
    • tests that prove the new code works
      • this means failure and success cases
    • new features, such as this, should be included in the BotTester.mocha.spec.ts and include proper decorations as can be seen in the file to easily update the README.md
    • add the new test to the README
    • PRs should be made to the dev branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions