microsoftly/BotTester

Error

Closed this issue · 16 comments

'node_modules' is not recognized as an internal or external command,

Can you give me repro steps?

Can you please guide me what file i need to create inside my test directory and how to configure that file inside package.json file script i am new in testing

This is a very broad and opinionated question that should be decided by the dev. As long as you install the package with npm install --save bot-tester or yarn add bot-tester you should be good to go. Just import and used as described in the docs. I'd recommend cloning this repo and running the tests yourself to see how to make it work.

An additional question, what test runner are you using (e.g. mocha + chai, jasmine, etc ...)?

Thanks

Hi microsoftly i am using mocha + chai

AssertionError: expected [ Array(1) ] to include undefined i am getting error please help

below is my code
process.env.NODE_ENV = 'development';

import { BotTester, TestConnector } from 'bot-tester';
import * as testBot from '../botfactory/server.js'

const connector = new TestConnector();

describe('BotTester', () => {
testBot.start(['vera']);
let bot = testBot.bots.vera.bot ;
it('Hi', () => {

    return new BotTester(bot)
         .sendMessageToBot("Hi", "How can I help you. You can say things like : \n\n\- I need to check my leave balance \n\n\- Apply for leave\n\n\ or\n\n- How do I set my goals\n\n- Who can I talk to about performance management")
         .runTest();
});

it('I need to check my leave balance', () => {
return new BotTester(bot)
.sendMessageToBot("I need to check my leave balance","Hello, I'm Vera your virtual HR Helpdesk bot. You can say things like :- I need to check my leave balance - Apply for leave or - How do I set my goals - Who can I talk to about performance management")
.runTest();
});

})

Summary: it is failing because you're not sending a response/the response is incorrect.

Actions you can take to verify: try this in the console or in an emulator and see what happens

longer answer:
This means that your bot is not handling the input correctly. You have sent it the message Hi and it is expecting How can I help you. You can say things like : \n\n\- I need to check my leave balance \n\n\- Apply for leave\n\n\ or\n\n- How do I set my goals\n\n- Who can I talk to about performance management as a response.

Instead you did not send a response or the response you have sent is empty (that's why its undefined).

I cannot give you any further input without knowing the code driving your bot.

For future submissions, please apply formatting for ease of reading and understanding.

Hi @microsoftly Thanks for your support
I am getting adaptive card response in json how can i check that this is correct response or not please help

..[application/vnd.microsoft.card.adaptive].................
{"$schema":"http://adaptivecards.io/schemas/adaptive-card.json","type":"AdaptiveCard","body":[{"type":"TextBlock","text":"Sure, I can help you with that. Let me ask
few quick questions to help you with that.","weight":"bolder","size":"medium","isSubtle":true,"color":"default","horizontalAlignment":"default","wrap":true},{"type":
"TextBlock","text":"Enter Full Name","weight":"bolder","size":"medium","isSubtle":true,"color":"default","horizontalAlignment":"default","wrap":true},{"type":"Input.
Text","id":"name","isRequired":true,"placeholder":"full name"},{"type":"TextBlock","text":"Enter EmployeeId","weight":"bolder","size":"medium","isSubtle":true,"color
":"default","horizontalAlignment":"default","wrap":true},{"type":"Input.Text","id":"employeeId","isRequired":true,"placeholder":"employee Id"}],"actions":[{"type":"A
ction.Submit","title":"Submit"}]}

At the moment, there is not adaptive card support. I will be working on it soon.

@krishan1kamal Adaptive card support has been added.

#45

Hi @microsoftly thanks for your support
how can i pass multiple adaptive card json? please help

I do not understand the question. Please refer to the existing tests as reference

I am getting error please help
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.

The error is telling you exactly what is happening. The test is timing out. You're either not returning a promise, not calling done, or your expected response is never returned

Hi @microsoftly its mocha timeout i have done with it thanks for your support
how can i pass multiple adaptive card json? please help
I have a multiple adaptive card in chat bot if i put one adaptive card value other adaptive card is appear i want to validate all adaptive card

and one more thing i want to know from you how i pass value of adaptive card field as a message
please help

Hi @microsoftly i have done with all question thanks for your support