Skip to content

Commit

Permalink
Merge pull request #1679 from jfougere/feature/comments-in-cucumber-json
Browse files Browse the repository at this point in the history
feat: added comments in Cucumber JSON result file
  • Loading branch information
ptrthomas authored Jul 12, 2021
2 parents 71ea64d + 2fac679 commit 204625f
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ public Map<String, Object> toCucumberJson() {
}
map.put("embeddings", embedList);
}
if (step.getComments() != null && !step.getComments().isEmpty()) {
map.put("comments", step.getComments());
}
return map;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,16 @@
]
},
"keyword": "*",
"line": 10,
"line": 12,
"doc_string": {
"content_type": "",
"value": "#string",
"line": 10
}
"line": 12
},
"comments": [
"# Some comments",
"# Some more comments"
]
},
{
"name": "call read('feature-result-called.feature')",
Expand All @@ -68,7 +72,7 @@
]
},
"keyword": "*",
"line": 11
"line": 13
},
{
"name": "com\/intuit\/karate\/core\/feature-result-called.feature",
Expand All @@ -82,7 +86,7 @@
]
},
"keyword": "",
"line": 11
"line": 13
},
{
"name": "print 'in called'",
Expand Down Expand Up @@ -154,11 +158,11 @@
]
},
"keyword": "*",
"line": 12,
"line": 14,
"doc_string": {
"content_type": "",
"value": "#string",
"line": 12
"line": 14
}
}
],
Expand Down Expand Up @@ -202,7 +206,7 @@
]
},
{
"line": 19,
"line": 21,
"name": "hello foo",
"description": "",
"id": "hello-foo",
Expand All @@ -221,11 +225,11 @@
]
},
"keyword": "*",
"line": 15,
"line": 17,
"doc_string": {
"content_type": "",
"value": "#string",
"line": 15
"line": 17
}
}
],
Expand Down Expand Up @@ -265,7 +269,7 @@
]
},
{
"line": 20,
"line": 22,
"name": "hello bar",
"description": "",
"id": "hello-bar",
Expand All @@ -284,11 +288,11 @@
]
},
"keyword": "*",
"line": 15,
"line": 17,
"doc_string": {
"content_type": "",
"value": "#string",
"line": 15
"line": 17
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Background:

@two
Scenario: hello world
# Some comments
# Some more comments
* print 'before'
* call read('feature-result-called.feature')
* print 'after'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
"status": "passed"
},
"step": {
"line": 10,
"comments": [
"# Some comments",
"# Some more comments"
],
"line": 12,
"prefix": "*",
"index": 0,
"text": "print 'before'"
Expand All @@ -38,7 +42,7 @@
"status": "passed"
},
"step": {
"line": 11,
"line": 13,
"prefix": "*",
"index": 1,
"text": "call read('feature-result-called.feature')"
Expand Down Expand Up @@ -131,7 +135,7 @@
"status": "passed"
},
"step": {
"line": 12,
"line": 14,
"prefix": "*",
"index": 2,
"text": "print 'after'"
Expand All @@ -153,7 +157,7 @@
"tags": [
"one",
"two"
]
]
},
{
"stepResults": [
Expand All @@ -179,7 +183,7 @@
"status": "passed"
},
"step": {
"line": 15,
"line": 17,
"prefix": "*",
"index": 0,
"text": "print 'name:', name"
Expand All @@ -190,12 +194,12 @@
"executorName": "main",
"name": "hello foo",
"description": "",
"line": 19,
"line": 21,
"sectionIndex": 1,
"startTime": "#number",
"endTime": "#number",
"exampleIndex": 0,
"refId": "[2.1:19]",
"refId": "[2.1:21]",
"durationMillis": "#number",
"failed": false,
"tags": [
Expand Down Expand Up @@ -229,7 +233,7 @@
"status": "passed"
},
"step": {
"line": 15,
"line": 17,
"prefix": "*",
"index": 0,
"text": "print 'name:', name"
Expand All @@ -240,20 +244,20 @@
"executorName": "#string",
"name": "hello bar",
"description": "",
"line": 20,
"line": 22,
"sectionIndex": 1,
"startTime": "#number",
"endTime": "#number",
"exampleIndex": 1,
"refId": "[2.2:20]",
"refId": "[2.2:22]",
"durationMillis": "#number",
"failed": false,
"tags": [
"one"
],
"exampleData": {
"name": "bar"
}
}
}
],
"prefixedPath": "classpath:com\/intuit\/karate\/core\/feature-result.feature",
Expand All @@ -267,4 +271,4 @@
"failedCount": 0,
"callDepth": 0,
"loopIndex": -1
}
}

0 comments on commit 204625f

Please sign in to comment.