watson-assistant-test
v1.4.0
Published
Runs automated testing on Watson Assistant Skill.
Downloads
6
Maintainers
Readme
Runs automated testing on Watson Assistant Skill.
Install
npm install -g watson-assistant-test
Usage
const AssistantTestSuite = require('watson-assistant-test')
let testSuite = new AssistantTestSuite({
url: 'YOUR_ASSISTANT_URL',
workspaceId: 'YOUR_ASSISTANT_WORKSPACE_ID', // Alternatively, provide the assistantId field to use the v2 API
apikey: 'YOUR_ASSISTANT_API_KEY',
version: '2021-01-01',
tests: [
{
name: 'Greet and say goodbye',
rounds: [
{ inputExpression: '{ input: { text: "Hello" } }', evaluateExpression: 'output.text[0] == "Hi! How can I help you?"' },
{ inputExpression: '{ input: { text: "Goodbye" }, context: context }', evaluateExpression: 'output.text[0] == "Bye bye!"' },
]
},
{
name: 'Book a visit',
rounds: [
{ inputExpression: '{ input: { text: "Hello" } }', evaluateExpression: 'output.text[0] == "Hi! How can I help you?"' },
{ inputExpression: '{ input: { text: "Book a visit" }, context: context }', evaluateExpression: 'output.text[0] == "When do you want to pay us a visit?"' },
{ inputExpression: '{ input: { text: "Tomorrow" }, context: context }', evaluateExpression: 'output.text[0] == "All done!"' },
]
},
]
})
let results = await testSuite.run()
Sample results
{
"success": false,
"passed": 1,
"failed": 1,
"details": [
{
"name": "Greet and say goodbye",
"success": true,
},
{
"name": "Book a visit",
"success": false,
"error": "Expression [output.text[0] == \"All done!\"] is false for obtained output { \"output\":{...}, context: {...} }"
}
]
}
Run tests
npm run test
Author
👤 Marco Cardoso
- Github: @MarcoABCardoso
- LinkedIn: @marco-cardoso
Show your support
Give a ⭐️ if this project helped you!