Classes
- Tester
- ResponseAssert
- AnyResponseAssert
- ConversationTester
Automated Conversation tests runner
Typedefs
- TestSource :
object
- TestCase :
object
- TextCase :
object
- TextTest :
object
- TestCaseStep :
object
- TestsGroup :
object
- List :
object
- TestsDefinition :
object
- testerFactory ⇒
Tester
Callback for getting a tester
- TestsOutput :
object
- Logger :
object
Tester
Kind: global class
- Tester
- new Tester()
- instance
- .processor :
Processor
- .testData
- .allowEmptyResponse
- .senderLogger
- .features
- .ATTACHMENT_MOCK_URL
- .setExpandRandomTexts([fixedIndex])
- .cleanup()
- .setFeatures([features])
- .processMessage(message, senderId, pageId, [data]) ⇒
Promise.<any>
- .res([index]) ⇒
ResponseAssert
- .any() ⇒
AnyResponseAssert
- .lastRes() ⇒
ResponseAssert
- .passedAction(path, [matchRequestActions]) ⇒
this
- .respondedWithBlock(blockName) ⇒
this
- .getState() ⇒
object
- .setState([state])
- .stateContains(object, [deep])
- .text(text) ⇒
Promise
- .attachment(type, [url]) ⇒
Promise
- .intent(intent, [text], [score]) ⇒
Promise
- .intentWithEntity(intent, entity, [value], [text], [score], [entityScore]) ⇒
Promise
- .entity(entity, [value], [text], [score]) ⇒
Promise
- .optin(action, [data], [userRef]) ⇒
Promise
- .quickReply(action, [data]) ⇒
Promise
- .quickReplyText(text) ⇒
Promise.<boolean>
- .postBack(action, [data], [refAction], [refData]) ⇒
Promise
- .debug([showPrivateKeys])
- .processor :
- static
new Tester()
Utility for testing requests
Processor
tester.processor : Kind: instance property of Tester
tester.testData
Kind: instance property of Tester
Properties
Name | Type | Description |
---|---|---|
predefined | object | test data to use |
tester.allowEmptyResponse
Kind: instance property of Tester
Properties
Name | Type | Description |
---|---|---|
allow | boolean | tester to process empty responses |
tester.senderLogger
Kind: instance property of Tester
Properties
Name | Type | Description |
---|---|---|
use | console | own loggger |
tester.features
Kind: instance property of Tester
Properties
Type |
---|
Array.<string> |
tester.ATTACHMENT_MOCK_URL
Kind: instance property of Tester
Properties
Type |
---|
string |
tester.setExpandRandomTexts([fixedIndex])
Enable tester to expand random texts It joins them into a single sting
Kind: instance method of Tester
Param | Type |
---|---|
[fixedIndex] | boolean |
tester.cleanup()
Clear acquired responses and data
Kind: instance method of Tester
tester.setFeatures([features])
Set features for all messages
Kind: instance method of Tester
Param | Type |
---|---|
[features] | Array.<string> |
Promise.<any>
tester.processMessage(message, senderId, pageId, [data]) ⇒ Use tester as a connector :)
Kind: instance method of Tester
Param | Type | Description |
---|---|---|
message | object | wingbot chat event |
senderId | string | chat event sender identifier |
pageId | string | channel/page identifier |
[data] | object | additional data |
ResponseAssert
tester.res([index]) ⇒ Returns single response asserter
Kind: instance method of Tester
Param | Type | Default | Description |
---|---|---|---|
[index] | number | 0 | response index |
AnyResponseAssert
tester.any() ⇒ Returns any response asserter
Kind: instance method of Tester
ResponseAssert
tester.lastRes() ⇒ Returns last response asserter
Kind: instance method of Tester
this
tester.passedAction(path, [matchRequestActions]) ⇒ Checks, that request passed an interaction
Kind: instance method of Tester
Param | Type | Default |
---|---|---|
path | string | |
[matchRequestActions] | boolean | false |
this
tester.respondedWithBlock(blockName) ⇒ Checks, that a plugin used a block as a response
Kind: instance method of Tester
Param | Type |
---|---|
blockName | string |
object
tester.getState() ⇒ Returns state
Kind: instance method of Tester
tester.setState([state])
Sets state with Object.assign()
Kind: instance method of Tester
Param | Type | Default |
---|---|---|
[state] | object | {} |
tester.stateContains(object, [deep])
Assert, that state contains a subset of provided value
Kind: instance method of Tester
Param | Type | Default |
---|---|---|
object | object | |
[deep] | boolean | false |
Example
t.stateContains({ value: true });
Promise
tester.text(text) ⇒ Makes text request
Kind: instance method of Tester
Param | Type |
---|---|
text | string |
Promise
tester.attachment(type, [url]) ⇒ Sends attachment
Kind: instance method of Tester
Param | Type | Default |
---|---|---|
type | 'image' | 'audio' | 'video' | 'file' | file |
[url] | string |
Promise
tester.intent(intent, [text], [score]) ⇒ Makes recognised AI intent request
Kind: instance method of Tester
Param | Type | Default |
---|---|---|
intent | string | Array.<string> | |
[text] | string | null |
[score] | number |
Promise
tester.intentWithEntity(intent, entity, [value], [text], [score], [entityScore]) ⇒ Makes recognised AI intent request with entity
Kind: instance method of Tester
Param | Type | Default |
---|---|---|
intent | string | |
entity | string | |
[value] | string | |
[text] | string | |
[score] | number | 1 |
[entityScore] | number |
Promise
tester.entity(entity, [value], [text], [score]) ⇒ Makes recognised AI request with entity
Kind: instance method of Tester
Param | Type | Default |
---|---|---|
entity | string | |
[value] | string | |
[text] | string | |
[score] | number | 1 |
Promise
tester.optin(action, [data], [userRef]) ⇒ Make optin call
Kind: instance method of Tester
Param | Type | Default | Description |
---|---|---|---|
action | string | ||
[data] | object | {} | |
[userRef] | string | null | specific ref string |
Promise
tester.quickReply(action, [data]) ⇒ Send quick reply
Kind: instance method of Tester
Param | Type | Default |
---|---|---|
action | string | |
[data] | object | {} |
Promise.<boolean>
tester.quickReplyText(text) ⇒ Send quick reply if text exactly matches, otherwise throws exception
Kind: instance method of Tester
Param | Type |
---|---|
text | string |
Promise
tester.postBack(action, [data], [refAction], [refData]) ⇒ Sends postback, optionally with referrer action
Kind: instance method of Tester
Param | Type | Default | Description |
---|---|---|---|
action | string | ||
[data] | object | {} | |
[refAction] | string | null | referred action |
[refData] | object | {} | referred action data |
tester.debug([showPrivateKeys])
Prints last conversation turnaround
Kind: instance method of Tester
Param | Type | Default |
---|---|---|
[showPrivateKeys] | boolean | false |
Tester.Tester
Kind: static class of Tester
new Tester(reducer, [senderId], [pageId], [processorOptions], [storage])
Creates an instance of Tester.
Param | Type | Default | Description |
---|---|---|---|
reducer | Router | ReducerWrapper | ||
[senderId] | string | null | |
[pageId] | string | null | |
[processorOptions] | ProcessorOptions | {} | options for Processor |
[storage] | MemoryStateStorage | place to override the storage |
ResponseAssert
Kind: global class
- ResponseAssert
- new ResponseAssert()
- instance
- .contains(search) ⇒
this
- .quickReplyAction(action) ⇒
this
- .templateType(type) ⇒
this
- .passThread([appId]) ⇒
this
- .attachmentType(type) ⇒
this
- .contains(search) ⇒
- static
- .AnyResponseAssert#contains(search) ⇒
this
- .AnyResponseAssert#notContains(search) ⇒
this
- .AnyResponseAssert#quickReplyAction(action) ⇒
this
- .AnyResponseAssert#quickReplyTextContains(search) ⇒
this
- .AnyResponseAssert#quickReplyTextNotContains(search) ⇒
this
- .AnyResponseAssert#templateType(type) ⇒
this
- .AnyResponseAssert#genericTemplate(itemCount)
- .AnyResponseAssert#buttonTemplate(search, buttonCount)
- .AnyResponseAssert#passThread([appId]) ⇒
this
- .AnyResponseAssert#attachmentType(type) ⇒
this
- .AnyResponseAssert#contains(search) ⇒
new ResponseAssert()
Utility for asserting single response
this
responseAssert.contains(search) ⇒ Checks, that response contains text
Kind: instance method of ResponseAssert
Param | Type |
---|---|
search | string | object |
this
responseAssert.quickReplyAction(action) ⇒ Checks quick response action
Kind: instance method of ResponseAssert
Param | Type |
---|---|
action | string |
this
responseAssert.templateType(type) ⇒ Checks template type
Kind: instance method of ResponseAssert
Param | Type |
---|---|
type | string |
this
responseAssert.passThread([appId]) ⇒ Checks pass thread control
Kind: instance method of ResponseAssert
Param | Type | Default |
---|---|---|
[appId] | string | null |
this
responseAssert.attachmentType(type) ⇒ Checks attachment type
Kind: instance method of ResponseAssert
Param | Type |
---|---|
type | string |
this
ResponseAssert.AnyResponseAssert#contains(search) ⇒ Checks, that response contains a text
Kind: static method of ResponseAssert
Param | Type |
---|---|
search | string | object |
this
ResponseAssert.AnyResponseAssert#notContains(search) ⇒ Checks, that response does NOT contain a text
Kind: static method of ResponseAssert
Param | Type |
---|---|
search | string |
this
ResponseAssert.AnyResponseAssert#quickReplyAction(action) ⇒ Checks quick response action
Kind: static method of ResponseAssert
Param | Type |
---|---|
action | string |
this
ResponseAssert.AnyResponseAssert#quickReplyTextContains(search) ⇒ Checks quick response text
Kind: static method of ResponseAssert
Param | Type |
---|---|
search | string |
this
ResponseAssert.AnyResponseAssert#quickReplyTextNotContains(search) ⇒ Checks for missing quick response text
Kind: static method of ResponseAssert
Param | Type |
---|---|
search | string |
this
ResponseAssert.AnyResponseAssert#templateType(type) ⇒ Checks template type
Kind: static method of ResponseAssert
Param | Type |
---|---|
type | string |
ResponseAssert.AnyResponseAssert#genericTemplate(itemCount)
Checks for generic template
Kind: static method of ResponseAssert
Param | Type | Default | Description |
---|---|---|---|
itemCount | number |
| specified item count |
ResponseAssert.AnyResponseAssert#buttonTemplate(search, buttonCount)
Checks for button template
Kind: static method of ResponseAssert
Param | Type | Default | Description |
---|---|---|---|
search | string | ||
buttonCount | number |
| specified button count |
this
ResponseAssert.AnyResponseAssert#passThread([appId]) ⇒ Checks pass thread control
Kind: static method of ResponseAssert
Param | Type | Default |
---|---|---|
[appId] | string | null |
this
ResponseAssert.AnyResponseAssert#attachmentType(type) ⇒ Checks attachment type
Kind: static method of ResponseAssert
Param | Type |
---|---|
type | string |
AnyResponseAssert
Kind: global class
new AnyResponseAssert()
Utility for searching among responses
ConversationTester
Automated Conversation tests runner
Kind: global class
- ConversationTester
- new ConversationTester(testsSource, botFactory, [options])
- ._getTestCases(lang) ⇒
Promise.<TestsDefinition>
- .test(validationRequestBody, [step], [lang], [snapshot]) ⇒
Promise.<TestsOutput>
- ._getLists(testCases) ⇒
Array.<List>
- ._getListCases(testCases) ⇒
Map.<string, (Array.<TestCase>|Array.<TextCase>)>
- ._getPagingForStepCases(testCases, lim)
- ._getGroups(testCases) ⇒
Array.<TestsGroup>
- ._getTestsGroups(testsGroups, step)
- ._createTester(testsGroup, [botconfig], [lang], [snapshot]) ⇒
Promise.<Tester>
- ._runTextCaseTests(testsGroup, botconfig, [lang], [snapshot])
- ._runStepCaseTests(testsGroup, botconfig, [lang], [snapshot])
- .executeTextCase(testsGroup, t, textCase, botconfig, longestText, [lang], [snapshot])
- .executeStep(t, step)
new ConversationTester(testsSource, botFactory, [options])
Param | Type | Description |
---|---|---|
testsSource | TestSource | Object.<string, TestSource> | single source or localized list |
botFactory | function | |
[options] | object | |
[options.disableAssertActions] | boolean | |
[options.disableAssertTexts] | boolean | |
[options.disableAssertQuickReplies] | boolean | |
[options.useConversationForTextTestCases] | boolean | |
[options.textThreshold] | number | |
[options.stepCasesPerStep] | number | |
[options.textCasesPerStep] | number | |
[options.textCaseParallel] | number | |
[options.allowEmptyResponse] | boolean | |
[options.log] | Logger | |
[options.testerFactory] | testerFactory |
Promise.<TestsDefinition>
conversationTester._getTestCases(lang) ⇒ Kind: instance method of ConversationTester
Param | Type |
---|---|
lang | string |
Promise.<TestsOutput>
conversationTester.test(validationRequestBody, [step], [lang], [snapshot]) ⇒ Runs the conversation test
Kind: instance method of ConversationTester
Param | Type | Default |
---|---|---|
validationRequestBody | object |
|
[step] | number |
|
[lang] | string | null |
[snapshot] | string | null |
Array.<List>
conversationTester._getLists(testCases) ⇒ Kind: instance method of ConversationTester
Param | Type |
---|---|
testCases | Array.<TestCase> | Array.<TextCase> |
Map.<string, (Array.<TestCase>|Array.<TextCase>)>
conversationTester._getListCases(testCases) ⇒ Kind: instance method of ConversationTester
Param | Type |
---|---|
testCases | Array.<TestCase> | Array.<TextCase> |
conversationTester._getPagingForStepCases(testCases, lim)
Kind: instance method of ConversationTester
Param | Type |
---|---|
testCases | Array.<TestCase> |
lim | number |
Array.<TestsGroup>
conversationTester._getGroups(testCases) ⇒ Kind: instance method of ConversationTester
Param | Type |
---|---|
testCases | * |
conversationTester._getTestsGroups(testsGroups, step)
Kind: instance method of ConversationTester
Param | Type |
---|---|
testsGroups | Array.<TestsGroup> |
step | number |
Promise.<Tester>
conversationTester._createTester(testsGroup, [botconfig], [lang], [snapshot]) ⇒ Kind: instance method of ConversationTester
Param | Type | Default |
---|---|---|
testsGroup | TestsGroup | |
[botconfig] | object |
|
[lang] | string | null |
[snapshot] | string | null |
conversationTester._runTextCaseTests(testsGroup, botconfig, [lang], [snapshot])
Kind: instance method of ConversationTester
Param | Type | Default |
---|---|---|
testsGroup | TestsGroup | |
botconfig | object |
|
[lang] | string | null |
[snapshot] | string | null |
conversationTester._runStepCaseTests(testsGroup, botconfig, [lang], [snapshot])
Kind: instance method of ConversationTester
Param | Type | Default |
---|---|---|
testsGroup | TestsGroup | |
botconfig | object |
|
[lang] | string | null |
[snapshot] | string | null |
conversationTester.executeTextCase(testsGroup, t, textCase, botconfig, longestText, [lang], [snapshot])
Kind: instance method of ConversationTester
Param | Type | Default |
---|---|---|
testsGroup | TestsGroup | |
t | Tester | |
textCase | TextTest | |
botconfig | * | |
longestText | number | |
[lang] | string | null |
[snapshot] | string | null |
conversationTester.executeStep(t, step)
Kind: instance method of ConversationTester
Param | Type |
---|---|
t | Tester |
step | TestCaseStep |
object
TestSource : Kind: global typedef
Properties
Name | Type |
---|---|
getTestCases | function |
object
TestCase : Kind: global typedef
Properties
Name | Type |
---|---|
list | string |
name | string |
steps | Array.<TestCaseStep> |
object
TextCase : Kind: global typedef
Properties
Name | Type |
---|---|
list | string |
name | string |
texts | Array.<TextTest> |
object
TextTest : Kind: global typedef
Properties
Name | Type |
---|---|
appId | string |
text | string |
action | string |
intent | string |
[rowNum] | number |
object
TestCaseStep : Kind: global typedef
Properties
Name | Type |
---|---|
step | number |
rowNum | number |
action | string |
passedAction | string |
textContains | string |
quickRepliesContains | string |
stepDescription | string |
object
TestsGroup : Kind: global typedef
Properties
Name | Type |
---|---|
listId | number |
list | string |
type | string |
testCases | Array.<TestCase> | Array.<TextTest> |
object
List : Kind: global typedef
Properties
Name | Type |
---|---|
id | number |
name | string |
type | string |
testCases | Array.<TestCase> | Array.<TextTest> |
object
TestsDefinition : Kind: global typedef
Properties
Name | Type |
---|---|
lists | Array.<List> |
Tester
testerFactory ⇒ Callback for getting a tester
Kind: global typedef
Param | Type | Description |
---|---|---|
bot | Router | ReducerWrapper | BuildRouter | the chatbot itself |
test | TestsGroup | the chatbot itself |
object
TestsOutput : Kind: global typedef
Properties
Name | Type |
---|---|
total | number |
passed | number |
failed | number |
skipped | number |
output | string |
summaryOutput | string |
step | number |
stepCount | number |
object
Logger : Kind: global typedef
Properties
Name | Type |
---|---|
log | function |
error | function |