Karate DSL - karate.info is not populated when Scenario outline is used with JSON Array in Examples
See original GitHub issueWe are using Karate for testing our application. We need to run multiple test with different testdata that is passed as a JSONArray from our test management tool. The JSONArray returned is used in Example section of Scenario Outline. The tests are getting executed properly.
Post execution to publish the result to our test management tool we tried using the afterScenario hook as mentioned in karate documentation.
* configure afterScenario =
"""
function(){
var info = karate.info;
karate.log('after', info);
}
"""
After each scenario of the example executed, we see the info details printed, but the error message details, scenario name etc are not populated when the example is a JSON Array. It works fine when the example is a Cucumber Table.
Karate.info printed when scenario outline is used with JSONArray in example:-
14:45:39.744 [main] ERROR com.intuit.karate - status code was: 400, expected: 200, response time: 754, url: ##url removed###, response: ##Response removed###
14:45:39.744 [main] INFO com.intuit.karate - after {
"featureDir": "C:\\Workspace\\Karate_Demo\\target\\test-classes\\com\\test\\Karate_Demo",
"scenarioType": "Scenario Outline",
"featureFileName": "TestIntegration.feature",
"errorMessage": null,
"scenarioDescription": "",
"scenarioName": "<title>"
}
Karate.info printed when scenario outline is used with cucumber example table:-
13:15:54.772 [main] ERROR com.intuit.karate - status code was: 400, expected: 200, response time: 1540, url: ##url removed###, response: ##Response removed###
13:15:54.795 [main] INFO com.intuit.karate - after {
"featureDir": "C:\\Workspace\\Karate_Demo\\target\\test-classes\\com\\test\\Karate_Demo"
"scenarioType": "Scenario",
"featureFileName": "Test.feature",
"errorMessage": "Test.feature:32 - status code was: 400, expected: 200, response time: 1540, url: ##url removed###, response: ##Response removed###,
"scenarioDescription": "",
"scenarioName": "Sample Test"
}
Karate Version: 0.9.5 Java Version - Open JDK 8 / 11 Intellij 2019.3.4 Attached Sample Project ScenarioOutline.zip
Attached Project has following features.
ScenarioOutlineExample_With_JSONArray.feature
- Feature with ScenarioOutline where example passed as a JSON Array
ScenarioOutlineExample_With_Table.feature
- Feature with ScenarioOutline where example passed as a normal Cucumber table
Command to run the tests:-
mvn clean test
Issue Raised based on StackOverflow Question:- https://stackoverflow.com/questions/61610048/karate-dsl-karate-info-is-not-populated-when-used-with-scenario-outline
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (5 by maintainers)
@jervarghese you already have 0.9.6.RC3 - please follow us on Twitter or LinkedIn if you want updates
0.9.6 released