Jira integration with Serenity and JUnit

593 views
Skip to first unread message

Prashant Maniktala

unread,
May 31, 2017, 7:08:52 PM5/31/17
to Serenity BDD Users Group
Hey Guys, 

I am trying to integrate Jira with Serenity and JUnit test framework. I have all the latest dependencies. 

Serenity files of version -1.4.1.-rc.2
And
serenity-jira-requirements-provider version - 1.1.3-rc.5

When I use the annotation @Issue, I get the following error.

I was wondering if someone can help me resolve the issue. 

Thanks in advance.

----------------
TEST PASSED: #UGCE-1737
----------------------------------------------------------------------------
[pool-2-thread-1] INFO net.thucydides.core.reports.json.JSONTestOutcomeReporter - Generating JSON report for #UGCE-1737 to file /Users/a1334152/IdeaProjects/samplejunit/target/site/serenity/e30378d1dfd2491ba82da4c01378d5397af2311a2cf7494fa615691435079482.json (using temp file /Users/a1334152/IdeaProjects/samplejunit/target/site/serenity/e30378d1dfd2491ba82da4c01378d5397af2311a2cf7494fa615691435079482.json850ffd12-25e2-4a16-b846-2cf6d49b96b9)
[pool-2-thread-2] ERROR net.thucydides.core.requirements.BaseRequirementsService - Tag provider failure
java.lang.IllegalArgumentException: net.serenitybdd.plugins.jira.model.JQLException: java.lang.NullPointerException
at net.serenitybdd.plugins.jira.requirements.JIRARequirementsProvider.getParentRequirementOf(JIRARequirementsProvider.java:266)
at net.thucydides.core.requirements.BaseRequirementsService.getParentRequirementOf(BaseRequirementsService.java:146)
at net.thucydides.core.requirements.BaseRequirementsService.getParentRequirementFor(BaseRequirementsService.java:63)
at net.thucydides.core.reports.html.HtmlAcceptanceTestReporter.addParentRequirmentFieldToContext(HtmlAcceptanceTestReporter.java:181)
at net.thucydides.core.reports.html.HtmlAcceptanceTestReporter.addTestOutcomeToContext(HtmlAcceptanceTestReporter.java:175)
at net.thucydides.core.reports.html.HtmlAcceptanceTestReporter.generateReportFor(HtmlAcceptanceTestReporter.java:112)
at net.thucydides.core.reports.ReportService.generateReportFor(ReportService.java:221)
at net.thucydides.core.reports.ReportService.access$100(ReportService.java:35)
at net.thucydides.core.reports.ReportService$1.run(ReportService.java:157)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
Caused by: net.serenitybdd.plugins.jira.model.JQLException: java.lang.NullPointerException
at net.serenitybdd.plugins.jira.client.JerseyJiraClient.findByKey(JerseyJiraClient.java:238)
at net.serenitybdd.plugins.jira.requirements.JIRARequirementsProvider.getParentRequirementOf(JIRARequirementsProvider.java:255)
... 13 more
Caused by: java.lang.NullPointerException
at net.serenitybdd.plugins.jira.client.JerseyJiraClient.toListOfVersions(JerseyJiraClient.java:431)
at net.serenitybdd.plugins.jira.client.JerseyJiraClient.convertToIssueSummary(JerseyJiraClient.java:277)
at net.serenitybdd.plugins.jira.client.JerseyJiraClient.loadByKey(JerseyJiraClient.java:247)
at net.serenitybdd.plugins.jira.client.FindByKeyLoader.load(FindByKeyLoader.java:16)
at net.serenitybdd.plugins.jira.client.FindByKeyLoader.load(FindByKeyLoader.java:7)
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3628)
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2336)
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2295)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2208)
at com.google.common.cache.LocalCache.get(LocalCache.java:4053)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4057)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4986)
at net.serenitybdd.plugins.jira.client.JerseyJiraClient.findByKey(JerseyJiraClient.java:234)
... 14 more

net.thucydides.core.reports.ReportGenerationFailedError: Failed to generate configuration report

at net.thucydides.core.reports.ReportService.waitForReportGenerationToFinish(ReportService.java:185)
at net.thucydides.core.reports.ReportService.generateReportsFor(ReportService.java:163)
at net.thucydides.core.reports.ReportService.generateReportsFor(ReportService.java:112)
at net.serenitybdd.junit.runners.SerenityRunner.generateReportsFor(SerenityRunner.java:410)
at net.serenitybdd.junit.runners.SerenityRunner.generateReports(SerenityRunner.java:305)
at net.serenitybdd.junit.runners.SerenityRunner.run(SerenityRunner.java:259)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at org.junit.vintage.engine.execution.RunnerExecutor.execute(RunnerExecutor.java:43)
at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Iterator.forEachRemaining(Iterator.java:116)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
at org.junit.vintage.engine.VintageTestEngine.executeAllChildren(VintageTestEngine.java:83)
at org.junit.vintage.engine.VintageTestEngine.execute(VintageTestEngine.java:74)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:137)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:87)
at org.junit.platform.launcher.Launcher.execute(Launcher.java:93)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:61)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.util.concurrent.ExecutionException: net.thucydides.core.reports.ReportGenerationFailedError: Failed to generate reports using net.thucydides.core.reports.html.HtmlAcceptanceTestReporter@10ee04df
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at net.thucydides.core.reports.ReportService.waitForReportGenerationToFinish(ReportService.java:182)
... 27 more
Caused by: net.thucydides.core.reports.ReportGenerationFailedError: Failed to generate reports using net.thucydides.core.reports.html.HtmlAcceptanceTestReporter@10ee04df
at net.thucydides.core.reports.ReportService.generateReportFor(ReportService.java:223)
at net.thucydides.core.reports.ReportService.access$100(ReportService.java:35)
at net.thucydides.core.reports.ReportService$1.run(ReportService.java:157)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: net.serenitybdd.plugins.jira.model.JQLException: java.lang.NullPointerException
at net.serenitybdd.plugins.jira.requirements.JIRARequirementsProvider.getParentRequirementOf(JIRARequirementsProvider.java:266)
at net.thucydides.core.requirements.BaseRequirementsService.getParentRequirementOf(BaseRequirementsService.java:146)
at net.thucydides.core.requirements.BaseRequirementsService.getAncestorRequirementsFor(BaseRequirementsService.java:93)
at net.thucydides.core.reports.html.HtmlAcceptanceTestReporter.addBreadcrumbs(HtmlAcceptanceTestReporter.java:210)
at net.thucydides.core.reports.html.HtmlAcceptanceTestReporter.addParentRequirmentFieldToContext(HtmlAcceptanceTestReporter.java:199)
at net.thucydides.core.reports.html.HtmlAcceptanceTestReporter.addTestOutcomeToContext(HtmlAcceptanceTestReporter.java:175)
at net.thucydides.core.reports.html.HtmlAcceptanceTestReporter.generateReportFor(HtmlAcceptanceTestReporter.java:112)
at net.thucydides.core.reports.ReportService.generateReportFor(ReportService.java:221)
... 7 more
Caused by: net.serenitybdd.plugins.jira.model.JQLException: java.lang.NullPointerException
at net.serenitybdd.plugins.jira.client.JerseyJiraClient.findByKey(JerseyJiraClient.java:238)
at net.serenitybdd.plugins.jira.requirements.JIRARequirementsProvider.getParentRequirementOf(JIRARequirementsProvider.java:255)
... 14 more
Caused by: java.lang.NullPointerException
at net.serenitybdd.plugins.jira.client.JerseyJiraClient.toListOfVersions(JerseyJiraClient.java:431)
at net.serenitybdd.plugins.jira.client.JerseyJiraClient.convertToIssueSummary(JerseyJiraClient.java:277)
at net.serenitybdd.plugins.jira.client.JerseyJiraClient.loadByKey(JerseyJiraClient.java:247)
at net.serenitybdd.plugins.jira.client.FindByKeyLoader.load(FindByKeyLoader.java:16)
at net.serenitybdd.plugins.jira.client.FindByKeyLoader.load(FindByKeyLoader.java:7)
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3628)
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2336)
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2295)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2208)
at com.google.common.cache.LocalCache.get(LocalCache.java:4053)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4057)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4986)
at net.serenitybdd.plugins.jira.client.JerseyJiraClient.findByKey(JerseyJiraClient.java:234)
... 15 more

May 31, 2017 5:59:50 PM org.junit.jupiter.engine.discovery.JavaElementsResolver resolveMethod
WARNING: Method 'public void com.bestbuy.serentybdd.features.questionAndAnwers.WhenUserSubmitsAQuestionForTheProductTest.userQuestionIsApproved()' could not be resolved

Process finished with exit code 255



Liviu Carausu

unread,
Jun 1, 2017, 10:50:38 AM6/1/17
to Serenity BDD Users Group

Hi,
 Is the @Issue present also in your JIRA system ?

Prashant Maniktala

unread,
Jun 1, 2017, 3:08:58 PM6/1/17
to Serenity BDD Users Group
Not sure how I would check that.

I am trying to integrate Jira with my Senerity-JUnit project. 

I updated the serenity.properties file with the Jira configuration values and when I use @Issue annotation with story number, the serenity report displays that story number as a link to jira next the test.

As a next Step, I want to get Epics and Stories from Jira to show up on the serenity report, so I can show coverage. 

I have included both "serenity-jira-plugin" and "serenity-jira-requirements-provider" dependencies in my pom.xml file under both dependency section and serenity reports plugin section.

But when I run without @Issue annotation, the serenity report does not get values from Jira. AND throws an error when I do use @Issue. 

 I hope this give a clear picture of what I am trying to do and and would appreciate all help and sample code. 

Thanks

Liviu Carausu

unread,
Jun 1, 2017, 5:49:54 PM6/1/17
to Serenity BDD Users Group
Hi,
  Something is unusual with the "fixVersions" of your issue. Can you tell me what is specified there ? Can you play with the "fixVersions" field of your issue and tell me if you see any improvement ?
Which version has your Jira server ?

Prashant Maniktala

unread,
Jun 2, 2017, 1:19:43 PM6/2/17
to Serenity BDD Users Group
So the Jira stories I was working with did not have any "fixVersion" field defined. 

I installed standalone Jira application on my machine and created a sample project with Epic and Stories and included the "fixVersion". And wallah, I see the stories and epics on my report. So thank you for your suggestion for looking into fix version field.

One more quick question...hope you can guide me.

I have tagged my test with the story number using the @Issue tag. The execution shows up in the Overall Test Results tab of the report. But the execution results do not get associated with the stories and epics which get pulled from the Jira. Is there some configuration I need to do for the test executions to get linked with the jira stories?
Reply all
Reply to author
Forward
0 new messages