jeudi 28 février 2019

How to fabricate a turnContext for testing Microsoft Botbuilder SDK?

IDE: Visual Studio 2017 SDK: Botbuilder V4 Emulator: Bot-Framework Emulator V4 Language: Node.js v11

Hi all. I am making test cases for some largely static functions/methods of my bot code. However, I will later need to test more advanced functionality of my bot to test for specific behavior. Does anyone know how to fabricate some parts of the turnContext?

For example, I am fabricating my own right now by manually creating a simulated turnContext JSON in the following way:

turnContext {
activity: {
    text: "custom test text",
    channelID: "custom ID",
    conversation: {
        id: "custom ID" } } }

The problem is that this fabricated context doesn't actually have the inhereted methods like turnContext.sendActivity('custom message');. So my tests will be limited to only the most basic functionality of the bot that won't actually guarantee the entire behavior is performing as designed.

Aucun commentaire:

Enregistrer un commentaire