microsoft / BotBuilder-Samples

Welcome to the Bot Framework samples repository. Here you will find task-focused samples in C#, JavaScript/TypeScript, and Python to help you get started with the Bot Framework SDK!
https://github.com/Microsoft/botframework
MIT License
4.36k stars 4.87k forks source link

Samples should include SetTestOptionsMiddleware #2694

Open chrimc62 opened 4 years ago

chrimc62 commented 4 years ago

A convenient way to generate a test is to generate a transcript using the emulator and then turn that transcript into a test script. The issue is that randomness in bots makes it impossible to replay a transcript. In order to fix this, the SDK has:

Defined SetTestOptionsMiddleware in Adaptive.Testing to pick up a SetTestOptions custom event and copy the payload into conversation.testOptions. We made the payload open ended. Defined randomSeed to seed a random number generator or randomValue to return a constant value from all calls to random and adjusted all users of random to make use of that. Defined a bf plugin that converts a transcript into a test script that supports the history and mocking.

Samples should include SetTestOptionsMiddleware so that when a transcript is recorded with a bot you can control randomness.

EricDahlvang commented 4 years ago

@chrimc62 Moved this from https://github.com/microsoft/BotFramework-Samples/ to https://github.com/microsoft/BotBuilder-Samples/