-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add ability to link test results with issues and tms (via #224)
- Loading branch information
Showing
6 changed files
with
259 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,23 +11,40 @@ export default class Reporter extends CucumberJSAllureFormatter { | |
constructor(options) { | ||
super( | ||
options, | ||
new AllureRuntime({ resultsDir: "./out/allure-results" }), | ||
new AllureRuntime({ resultsDir: "./allure-results" }), | ||
{ | ||
labels: { | ||
issue: [/@bug_(.*)/], | ||
epic: [/@feature:(.*)/] | ||
epic: [/@feature:(.*)/], | ||
severity: [/@severity:(.*)/] | ||
}, | ||
links: { | ||
issue: { | ||
pattern: [/@issue=(.*)/], | ||
urlTemplate: "http://localhost:8080/issue/%s" | ||
}, | ||
tms: { | ||
pattern: [/@tms=(.*)/], | ||
urlTemplate: "http://localhost:8080/tms/%s" | ||
} | ||
} | ||
} | ||
); | ||
} | ||
} | ||
``` | ||
This class MUST: | ||
* Be a default export | ||
* Extend `CucumberJSAllureFormatter` | ||
* Take 1 argument in constructor and pass it to `super()` as first argument | ||
* Second `super()` argument is `AllureRuntime` instance | ||
* Third is a config, currently allows to map tags to Allure labels | ||
This class **MUST**: | ||
* Be a default export. | ||
* Extend `CucumberJSAllureFormatter`. | ||
* First `super()` argument is the first argument in the `constructor`. | ||
* Second `super()` argument is an `AllureRuntime` instance. | ||
* Third argument is a config object which allows: | ||
* Map tags to Allure labels. | ||
* Add links to external sites like JIRA, XRAY, etc. `%s` will be auto-replaced by the issue id. Example: | ||
```gherkin | ||
@issue=TEST-1 | ||
Scenario: Example for scenario issue link check | ||
Then the issue link should be "http://localhost:8080/issue/TEST-1" | ||
``` | ||
|
||
Then pass with reporter as a Cucumber formatter: | ||
``` | ||
|
@@ -68,3 +85,5 @@ Ilya Korobitsyn <[email protected]> | |
#### Contributors | ||
|
||
* Claudia Hardman <[email protected]> | ||
* Max Di Maria <[email protected]> | ||
* Daniel Montesinos <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
Feature: Links | ||
|
||
Background: | ||
Given a allure formatter file with config: | ||
""" | ||
{ | ||
links: { | ||
issue: { | ||
pattern: [/@issue=(.*)/], | ||
urlTemplate: "http://localhost:8080/issue/%s" | ||
}, | ||
tms: { | ||
pattern: [/@tms=(.*)/], | ||
urlTemplate: "http://localhost:8080/tms/%s" | ||
} | ||
} | ||
} | ||
""" | ||
|
||
Scenario: Reporting scenario issue link | ||
Given a feature: | ||
""" | ||
Feature: Feature issue links | ||
@issue=TEST | ||
Scenario: Example for scenario issue link check | ||
When do passing step | ||
Then do passing step | ||
""" | ||
When I run cucumber-js with allure | ||
Then it passes | ||
Then it has result for "Example for scenario issue link check" | ||
|
||
When I choose result for "Example for scenario issue link check" | ||
Then it has link with url "http://localhost:8080/issue/TEST" with name "TEST" and with type "issue" | ||
|
||
Scenario: Reporting scenario tms link | ||
Given a feature: | ||
""" | ||
Feature: Feature issue links | ||
@tms=TEST | ||
Scenario: Example for scenario tms link check | ||
When do passing step | ||
Then do passing step | ||
""" | ||
When I run cucumber-js with allure | ||
Then it passes | ||
Then it has result for "Example for scenario tms link check" | ||
|
||
When I choose result for "Example for scenario tms link check" | ||
Then it has link with url "http://localhost:8080/tms/TEST" with name "TEST" and with type "tms" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.