Botium provides test result download links in formats suitable for further processing. The structure of these downloads can be customized to fit your needs. Continue reading to learn more.
Where to place the customization code?
For each export format, the customization code has to be placed in the resources
directory of Botium:
resources/extensions/testresults/<format>.js
- json
- junit
- csv
- jiracsv
How to write customization code?
resources/extensions/testresults/json.js
):const os = require('os')
module.exports = ({ testSessionResults, testSessionSettings, testSessionTestSets, testSessionLink }) => {
return {
testSessionResults,
testSessionSettings,
testSessionTestSets,
testSessionLink,
hostname: os.hostname()
}
}
You can adapt all exports to your needs. Botium includes the PDFKit library, so you can even customize the PDF export to your company layout.
The function will be called with several parameters, and you can use any available NPM module you want in your function code. The parameters are:
- testSessionResults: The test session results (test cases and test result, error information, …)
- testSessionSettings: Settings of the test session (test sets, chatbots, …)
- testSessionTestSets: Description of the involved test sets
Full Content Sample
{
"testSessionResults":{
"id":"ck0fg6d1y00g10691094ysw8g",
"name":"Echo Bot - Test Suite - Test Session",
"status":"FAILED",
"createdAt":"2019-09-11T15:57:25.269Z",
"client":null,
"results":[
{
"id":"ck0fg6fun00ii0691bxsd4hv1",
"testcaseName":"give me buttons",
"createdAt":"2019-09-11T15:57:28.891Z",
"testcaseSource":"1 give me buttons ({ testSetId: 'ck0dzt0fy00f90691zgx440uf',\n testSetScriptId: 'ck0dzt0gb00fc0691bdqjr89r' }): Line 3: #me - Hi Bot! | Line 6: #bot - You said: Hi Bot! | Line 9: #me - give me buttons | Line 12: #bot - Here are some buttons BUTTONS(First Button,Second Button)",
"success":true,
"err":null,
"errDetails":null,
"duration":17,
"testSet":{
"id":"ck0dzt0fy00f90691zgx440uf",
"name":"Echo Sample",
"tags":[
"Demo"
]
},
"testSetRepository":null,
"testSetFolder":null,
"testSetExcel":null,
"testSetFilename":null
},
{
"id":"ck0fg6hli00ju0691guolafwj",
"testcaseName":"give me picture",
"createdAt":"2019-09-11T15:57:31.153Z",
"testcaseSource":"2 give me picture ({ testSetId: 'ck0dzt0fy00f90691zgx440uf',\n testSetScriptId: 'ck0dzt0g300fa0691qrtk0ccf' }): Line 3: #me - Hello, Bot! | Line 6: #bot - You said: Hello, Bot! | Line 9: #me - give me a picture | Line 12: #bot - Here is a picture MEDIA(http://www.botium.at/img/logo.png)",
"success":true,
"err":null,
"errDetails":null,
"duration":21,
"testSet":{
"id":"ck0dzt0fy00f90691zgx440uf",
"name":"Echo Sample",
"tags":[
"Demo"
]
},
"testSetRepository":null,
"testSetFolder":null,
"testSetExcel":null,
"testSetFilename":null
},
{
"id":"ck0fg6jfh00lb0691z4g1ygm9",
"testcaseName":"should fail",
"createdAt":"2019-09-11T15:57:33.530Z",
"testcaseSource":"3 should fail ({ testSetId: 'ck0dzt0fy00f90691zgx440uf',\n testSetScriptId: 'ck0fg6a6i00f40691qdcy8qf2' }): Line 3: #me - hi | Line 6: #bot - asdf",
"success":false,
"err":"should fail/Line 6: Expected bot response (on Line 3: #me - hi) \"You said: hi\" to match one of \"asdf\"",
"errDetails":"[{\"type\":\"asserter\",\"source\":\"TextMatchAsserter\",\"context\":{\"stepTag\":\"should fail/Line 6\"},\"cause\":{\"expected\":[\"asdf\"],\"actual\":\"You said: hi\"},\"message\":\"should fail/Line 6: Expected bot response (on Line 3: #me - hi) \\\"You said: hi\\\" to match one of \\\"asdf\\\"\"}]",
"duration":16,
"testSet":{
"id":"ck0dzt0fy00f90691zgx440uf",
"name":"Echo Sample",
"tags":[
"Demo"
]
},
"testSetRepository":null,
"testSetFolder":null,
"testSetExcel":null,
"testSetFilename":null
}
]
},
"testSessionSettings":{
"id":"ck0fg6d1y00g10691094ysw8g",
"name":"Echo Bot - Test Suite - Test Session",
"client":null,
"description":null,
"createdAt":"2019-09-11T15:57:25.269Z",
"securityCheck":null,
"tags":[
"BoxTriggered"
],
"batchCount":3,
"bail":null,
"chatbot":{
"id":"ck0dzt02700e806913cs79iwo",
"name":"Echo Bot",
"description":"Chatbot simulator for evaluating Botium and Botium features. Sample commands: 'buttons', 'show me buttons', 'picture', 'show me a picture', 'card', 'show me a card'. Otherwise the input is echoed back.",
"tags":[
"Demo"
],
"retryUserSaysNumRetries":null,
"retryUserSaysFactor":null,
"retryUserSaysMinTimeout":null,
"retryUserSaysOnErrorRegexp":[
],
"capabilities":[
{
"name":"CONTAINERMODE",
"type":"STRING",
"stringValue":"echo",
"intValue":null,
"booleanValue":null,
"jsonValue":null
}
],
"sources":[
],
"envs":[
]
},
"testSets":[
{
"id":"ck0dzt0fy00f90691zgx440uf",
"name":"Echo Sample",
"useMatchingMode":null,
"expandConvos":true,
"expandConvosMode":null,
"expandConvosModeRandomCount":null,
"expandUtterancesToConvos":false,
"expandUtterancesIncomprehension":null,
"useScriptingMemory":true,
"useScriptingMemoryMatchingMode":null,
"expandScriptingMemory":false,
"normalizeText":true
}
],
"deviceSets":[
],
"testProject":{
"id":"ck0dzt0v600gf0691rvtavkcz",
"name":"Echo Bot - Test Suite",
"description":"Test Suite for Echo chatbot",
"tags":[
"Demo"
],
"capabilities":[
]
},
"registeredComponents":[
],
"agent":null,
"capabilities":[
],
"sources":[
],
"envs":[
]
},
"testSessionTestSets":[
{
"id":"ck0dzt0fy00f90691zgx440uf",
"name":"Echo Sample",
"description":"Just some basic sample scripts",
"tags":[
"Demo"
],
"useMatchingMode":null,
"expandConvos":true,
"expandConvosMode":null,
"expandConvosModeRandomCount":null,
"expandUtterancesToConvos":false,
"expandUtterancesIncomprehension":null,
"useScriptingMemory":true,
"useScriptingMemoryMatchingMode":null,
"expandScriptingMemory":false,
"normalizeText":true,
"excelHasConvos":null,
"excelHasPartialConvos":null,
"excelHasUtterances":null,
"excelWorksheetsConvos":null,
"excelWorksheetsPartialConvos":null,
"excelWorksheetsUtterances":null,
"excelStartRow":null,
"excelStartCol":null,
"selectionType":null,
"scripts":[
{
"id":"ck0dzt0g300fa0691qrtk0ccf",
"name":"give me picture",
"script":"give me picture\n\n#me\nHello, Bot!\n\n#bot\nYou said: Hello, Bot!\n\n#me\ngive me a picture\n\n#bot\nHere is a picture\nMEDIA http://www.botium.at/img/logo.png\n",
"scriptType":"SCRIPTING_TYPE_CONVO"
},
{
"id":"ck0dzt0gb00fc0691bdqjr89r",
"name":"give me buttons",
"script":"give me buttons\n\n#me\nHi Bot!\n\n#bot\nYou said: Hi Bot!\n\n#me\ngive me buttons\n\n#bot\nHere are some buttons\nBUTTONS First Button|Second Button\n",
"scriptType":"SCRIPTING_TYPE_CONVO"
},
{
"id":"ck0fg6a6i00f40691qdcy8qf2",
"name":"should fail",
"script":"should fail\n\n#me\nhi\n\n#bot\nasdf",
"scriptType":"SCRIPTING_TYPE_CONVO"
}
],
"repositories":[
],
"folders":[
],
"excels":[
],
"dependencies":[
]
}
],
"testSessionLink":"http://127.0.0.1:4000/testsessions/view/ck0fg6d1y00g10691094ysw8g",
"hostname":"my-host-ame"
}