Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to make use of the SerenityBDD - JIRA integration? #189

Closed
cmurczek-it opened this issue Mar 19, 2018 · 11 comments
Closed

Is there a way to make use of the SerenityBDD - JIRA integration? #189

cmurczek-it opened this issue Mar 19, 2018 · 11 comments
Labels
documentation enhancement @serenity-js/core

Comments

@cmurczek-it
Copy link

@cmurczek-it cmurczek-it commented Mar 19, 2018

Is it possible to use the JIRA integration of SerenityBDD with serenity-js? I tried using the configuration as described here (http://serenity-bdd.info/docs/serenity/#_feature_coverage) but no success so far.

I have assigned @issue tags to scenarios In my .feature files, but when generating the report serenity won't include the link to (tried specifiying jira.user/password/project/url settings via serenity.properties, as well as --jiraProject and --jiraUrl cli options), nor add pending tests based on jira issues.

@jan-molak jan-molak added enhancement documentation @serenity-js/core labels Jul 26, 2018
@JGONGSQ
Copy link

@JGONGSQ JGONGSQ commented Aug 29, 2018

Any progress on this feature? Appreciated.

@abhinaba-ghosh
Copy link

@abhinaba-ghosh abhinaba-ghosh commented Jun 26, 2019

@jan-molak Please update if you have any progress on that. Many thanks. It will be awesome if Solution support cucumber 1.x version (i.e Serenity-js 1)

@iranicus
Copy link

@iranicus iranicus commented Nov 11, 2019

Having recently decided to give serenity-js (v1) a go for one of our angular 4 projects, this is currently a feature in the older selenium framework I am moving the project away from. It would be handy if it were an option for serenity-js v1 too since it was handy to have the Jira refs in the reports for the client.

@jan-molak
Copy link
Member

@jan-molak jan-molak commented Nov 12, 2019

I need to look into enabling the JIRA integration properly.

In the meantime, remember that Serenity treats Cucumber scenario and feature descriptions as markdown, so you could have JIRA links there:

Feature: JIRA Integration

  Here's the [JIRA epic](https://jira.my.org/....)

  Scenario: Scenario name

    Here is [the ticket](https://jira.my.org/....)

    Given ...
    When ...
    Then ...

@brabenetz
Copy link

@brabenetz brabenetz commented Mar 10, 2020

I have assigned @issue tags to scenarios In my .feature files, but when generating the report serenity won't include the link to

I think I found the root-cause, and have a (very ugly) workaround for it.

First I need the cucumber results also as json format "json:target/cucumber.json" in my protractor.conf.js:

    cucumberOpts: {
        tags: ['~@Ignore', '@Regression'],
        require: [path.join(__dirname, 'src/step_definitions/**/*-steps.ts')],
        format: ["pretty", "json:target/cucumber.json"],
        keepAlive: false
    }

But the cucumber tests generates only an "issues"-node into the json-results:

    "issues": [
        "JIRA-123"
    ],

The Java-Version of cucumber generates also a "additionalIssues"-node into the json-results:

    "issues": [
        "JIRA-123"
    ],
    "additionalIssues": [
        "JIRA-123"
    ],

The Java serenity-cli (which is called by the serenity-js) seems only to read the "additionalIssues"-node...


Now comes my ugly workaround:
I just patches the results of the tests before run "serenity:run":


package.json scripts/dependencies (simplified):

  "scripts": {
    "e2e": "failsafe e2e:rimraf e2e:test e2e:fix-issues-in-report-results e2e:report",
    "e2e:rimraf": "rimraf target/site",
    "e2e:test": "ng e2e --project=testbed --webdriver-update=false",
    "e2e:fix-issues-in-report-results": "node e2e/fix-issues-in-report-results.js",
    "e2e:report": "serenity run"
  },
  "dependencies": {
    "npm-failsafe": "^0.4.1",
    "replace": "1.0.0"
  }

fix-issues-in-report-results.js:

var replace = require('replace');
replace({
  regex: "\"issues\"",
  replacement: "\"additionalIssues\"",
  paths: ['target/site'],
  recursive: true,
  include: '*.json',
  silent: false,
  quiet: false,
  multiline: true,
});

I use a "serenity.properties" to configure the "serenity.issue.tracker.url", but there are many ways to configure that.

@brabenetz
Copy link

@brabenetz brabenetz commented Mar 11, 2020

Update: "json:target/cucumber.json" is not needed, the json-files per test will allways be written into target/site/serenity/*.json
The config format: ["pretty"], is enough:

    cucumberOpts: {
        tags: ['~@Ignore', '@Regression'],
        require: [path.join(__dirname, 'src/step_definitions/**/*-steps.ts')],
        format: ["pretty"],
        keepAlive: false
    }

@jan-molak
Copy link
Member

@jan-molak jan-molak commented Mar 12, 2020

Thanks for taking the time to investigate the root cause, @brabenetz.
So do I understand correctly that replacing issues with additionalIssues via that regex replace has addressed the problem?

@brabenetz
Copy link

@brabenetz brabenetz commented Mar 12, 2020

Yes, seems so... (The java version writes the ids into "issues" & "additionalIssues")
With the regex replace, my Jira links (from the "serenity.issue.tracker.url") are now shown on the reports.

@jan-molak
Copy link
Member

@jan-molak jan-molak commented Mar 15, 2020

Hi @cmurczek, @cmelion, @san-ouadghiri, @andreasgebauer, @otoniel-isidoro-sofist, @JGONGSQ, @brabenetz, @iranicus, @datentyp and @abhinaba1080!

This feature required introducing changes in Serenity BDD Core, Serenity BDD CLI and Serenity/JS projects so it all took a while to implement.

Integration with Jira (and other issue trackers, such as Trello) is available as of @serenity-js/serenity-bdd-reporter v2.3.0, so please take it for a spin and let me know what you think!

I also took some time to describe configuring the integration in a bit more depth in Serenity/JS Handbook: Integration - Jira and other issue trackers.

By the way, if you have found this feature useful, please consider becoming a Github Sponsor of Serenity/JS and buying us a coffee every once in a while :octocat:

Best,
Jan

@brabenetz
Copy link

@brabenetz brabenetz commented Apr 24, 2020

FYI,
Thanks, it works fine on my Project (it only took me a while to upgrade from serenity-js 1 to 2).

But my first touch with the new feature did not work that well.
I tried to adapt the serenity-js demo-app: https://github.com/serenity-js/serenity-js-jasmine-protractor-template

  1. features/super_calculator.feature: Add Annotation "@issue:189"
  2. package.json: "test:report": "serenity-bdd run --issueTrackerUrl 'https://github.com/serenity-js/serenity-js/issues/{0}' --features ./features",

The result was a big fat NPE (see serenity-core ticket)!

But the error "only" occurs if the Issue ID is a number. It works fine if the Issue ID would have a prefix like "@issue:XYZ-189".
(With that it is not a Problem on my current Project).

But I opened a Ticket in serenity-core anyway:
serenity-bdd/serenity-core#2049

@jan-molak
Copy link
Member

@jan-molak jan-molak commented Apr 27, 2020

Glad you managed to sort it out @brabenetz, thanks for letting me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation enhancement @serenity-js/core
Projects
Development

No branches or pull requests

6 participants