features/json_formatter.feature in cucumber-1.1.0 vs features/json_formatter.feature in cucumber-1.1.1
- old
+ new
@@ -60,87 +60,85 @@
"""
Scenario: one feature, one passing scenario, one failing scenario
When I run cucumber "--format json features/one_passing_one_failing.feature"
- Then the output should match /^\{"features":\[/
-
- Scenario: one feature, one passing scenario, one failing scenario
- When I run cucumber "--format json features/one_passing_one_failing.feature"
Then it should fail with JSON:
"""
- {
- "features": [
- {
- "keyword": "Feature",
- "name": "One passing scenario, one failing scenario",
- "line": 2,
- "description": "",
- "tags": [
- {
- "name": "@a",
- "line": 1
- }
- ],
- "elements": [
- {
- "keyword": "Scenario",
- "name": "Passing",
- "line": 5,
- "description": "",
- "tags": [
- {
- "name": "@b",
- "line": 4
+ [
+ {
+ "uri": "features/one_passing_one_failing.feature",
+ "keyword": "Feature",
+ "id": "one-passing-scenario,-one-failing-scenario",
+ "name": "One passing scenario, one failing scenario",
+ "line": 2,
+ "description": "",
+ "tags": [
+ {
+ "name": "@a",
+ "line": 1
+ }
+ ],
+ "elements": [
+ {
+ "keyword": "Scenario",
+ "id": "one-passing-scenario,-one-failing-scenario;passing",
+ "name": "Passing",
+ "line": 5,
+ "description": "",
+ "tags": [
+ {
+ "name": "@b",
+ "line": 4
+ }
+ ],
+ "type": "scenario",
+ "steps": [
+ {
+ "keyword": "Given ",
+ "name": "a passing step",
+ "line": 6,
+ "match": {
+ "location": "features/step_definitions/steps.rb:1"
+ },
+ "result": {
+ "status": "passed"
}
- ],
- "type": "scenario",
- "steps": [
- {
- "keyword": "Given ",
- "name": "a passing step",
- "line": 6,
- "match": {
- "location": "features/step_definitions/steps.rb:1"
- },
- "result": {
- "status": "passed"
- }
+ }
+ ]
+ },
+ {
+ "keyword": "Scenario",
+ "id": "one-passing-scenario,-one-failing-scenario;failing",
+ "name": "Failing",
+ "line": 9,
+ "description": "",
+ "tags": [
+ {
+ "name": "@c",
+ "line": 8
+ }
+ ],
+ "type": "scenario",
+ "steps": [
+ {
+ "keyword": "Given ",
+ "name": "a failing step",
+ "line": 10,
+ "match": {
+ "location": "features/step_definitions/steps.rb:5"
+ },
+ "result": {
+ "status": "failed",
+ "error_message": " (RuntimeError)\n./features/step_definitions/steps.rb:6:in `/a failing step/'\nfeatures/one_passing_one_failing.feature:10:in `Given a failing step'"
}
- ]
- },
- {
- "keyword": "Scenario",
- "name": "Failing",
- "line": 9,
- "description": "",
- "tags": [
- {
- "name": "@c",
- "line": 8
- }
- ],
- "type": "scenario",
- "steps": [
- {
- "keyword": "Given ",
- "name": "a failing step",
- "line": 10,
- "match": {
- "location": "features/step_definitions/steps.rb:5"
- },
- "result": {
- "status": "failed",
- "error_message": " (RuntimeError)\n./features/step_definitions/steps.rb:6:in `/a failing step/'\nfeatures/one_passing_one_failing.feature:10:in `Given a failing step'"
- }
- }
- ]
- }
- ]
- }
- ]
- }
+ }
+ ]
+ }
+ ]
+ }
+ ]
"""
Scenario: DocString
Given a file named "features/doc_string.feature" with:
@@ -160,89 +158,91 @@
end
"""
When I run cucumber "--format json features/doc_string.feature"
Then it should fail with JSON:
"""
- {
- "features": [
- {
- "keyword": "Feature",
- "name": "A DocString feature",
- "line": 1,
- "description": "",
- "elements": [
- {
- "keyword": "Scenario",
- "name": "",
- "line": 3,
- "description": "",
- "type": "scenario",
- "steps": [
- {
- "keyword": "Then ",
- "name": "I should fail with",
- "line": 4,
- "doc_string": {
- "content_type": "",
- "value": "a string",
- "line": 5
- },
- "match": {
- "location": "features/step_definitions/doc_string_steps.rb:1"
- },
- "result": {
- "status": "failed",
- "error_message": "a string (RuntimeError)\n./features/step_definitions/doc_string_steps.rb:2:in `/I should fail with/'\nfeatures/doc_string.feature:4:in `Then I should fail with'"
- }
- }
- ]
- }
- ]
- }
- ]
- }
- """
-
- Scenario: embedding screenshot
- When I run cucumber "-b --format json features/embed.feature"
- Then it should pass with JSON:
- """
- {
- "features": [
+ [
{
+ "id": "a-docstring-feature",
+ "uri": "features/doc_string.feature",
"keyword": "Feature",
- "name": "A screenshot feature",
+ "name": "A DocString feature",
"line": 1,
"description": "",
"elements": [
{
+ "id": "a-docstring-feature;",
"keyword": "Scenario",
"name": "",
"line": 3,
"description": "",
"type": "scenario",
"steps": [
{
- "keyword": "Given ",
- "name": "I embed a screenshot",
+ "keyword": "Then ",
+ "name": "I should fail with",
"line": 4,
- "embeddings": [
- {
- "mime_type": "image/png",
- "data": "Zm9v"
- }
- ],
+ "doc_string": {
+ "content_type": "",
+ "value": "a string",
+ "line": 5
+ },
"match": {
- "location": "features/step_definitions/steps.rb:29"
+ "location": "features/step_definitions/doc_string_steps.rb:1"
},
"result": {
- "status": "passed"
+ "status": "failed",
+ "error_message": "a string (RuntimeError)\n./features/step_definitions/doc_string_steps.rb:2:in `/I should fail with/'\nfeatures/doc_string.feature:4:in `Then I should fail with'"
}
}
]
}
]
}
]
- }
+ """
+
+ Scenario: embedding screenshot
+ When I run cucumber "-b --format json features/embed.feature"
+ Then it should pass with JSON:
+ """
+ [
+ {
+ "uri": "features/embed.feature",
+ "id": "a-screenshot-feature",
+ "keyword": "Feature",
+ "name": "A screenshot feature",
+ "line": 1,
+ "description": "",
+ "elements": [
+ {
+ "id": "a-screenshot-feature;",
+ "keyword": "Scenario",
+ "name": "",
+ "line": 3,
+ "description": "",
+ "type": "scenario",
+ "steps": [
+ {
+ "keyword": "Given ",
+ "name": "I embed a screenshot",
+ "line": 4,
+ "embeddings": [
+ {
+ "mime_type": "image/png",
+ "data": "Zm9v"
+ }
+ ],
+ "match": {
+ "location": "features/step_definitions/steps.rb:29"
+ },
+ "result": {
+ "status": "passed"
+ }
+ }
+ ]
+ }
+ ]
+ }
+ ]
"""