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

Jenkins Cucumber net.masterthought.jenkins.CucumberReportPublisher aborted: NullPointerException #42

Closed
PranavPatil opened this issue Nov 2, 2012 · 1 comment

Comments

@PranavPatil
Copy link

Hi
I am having the similar issue and getting following exception in Jenkins while generating the reports.

[CucumberReportPublisher] Compiling Cucumber Html Reports ...
[CucumberReportPublisher] copying json from: file:/c:/.jenkins/workspace/cucumber-acceptance-tests/to reports directory: file:/e:/.jenkins/jobs/cucumber-acceptance-tests/builds/2012-11-01_16-13-02/cucumber-html-reports/
[CucumberReportPublisher] Generating HTML reports
ERROR: Publisher net.masterthought.jenkins.CucumberReportPublisher aborted due to exception
java.lang.NullPointerException
at net.masterthought.cucumber.util.Util.collectSteps(Util.java:104)

I am using the "cucumber-reports 0.0.14" plugin on Jenkins ver. 1.444.
I tried with setting "Json Reports Path" as "target" and empty. The "Plugin Url Path" is empty

The JSON File is in "ci/job/cucumber-acceptance-tests/ws/storytests/target/cucumber.json" as follows:
[
{
"id":"some-feature",
"tags":[
{
"name":"@mytests",
"line":1
}
],
"description":"",
"name":"some feature",
"keyword":"Feature",
"line":2,
"elements":[
{
"id":"some-feature;setup",
"tags":[
{
"name":"@setup11",
"line":4
}
],
"description":"",
"name":"Setup",
"keyword":"Scenario",
"line":5,
"type":"scenario"
},
{
"id":"some-feature;one",
"description":"",
"name":"one",
"keyword":"Scenario",
"line":7,
"steps":[
{
"name":"X",
"keyword":"Given ",
"line":8
},
{
"name":"Y",
"keyword":"When ",
"line":9
},
{
"result":{
"duration":482295,
"status":"passed"
},
"name":"Z",
"keyword":"Then ",
"line":10,
"match":{
"location":"FoobarSteps.Z()"
}
}
],
"type":"scenario"
},
{
"id":"some-feature;abc",
"description":"",
"name":"abc",
"keyword":"Scenario",
"line":12,
"steps":[
{
"name":"X",
"keyword":"Given ",
"line":13
},
{
"name":"Y",
"keyword":"When ",
"line":14
},
{
"result":{
"duration":476918,
"status":"passed"
},
"name":"Z",
"keyword":"Then ",
"line":15,
"match":{
"location":"FoobarSteps.Z()"
}
}
],
"type":"scenario"
},
{
"id":"some-feature;new-one",
"description":"",
"name":"new one",
"keyword":"Scenario",
"line":17,
"steps":[
{
"name":"X is height",
"keyword":"Given ",
"line":18
},
{
"name":"Y is height",
"keyword":"When ",
"line":19
},
{
"result":{
"duration":428535,
"status":"passed"
},
"name":"Z is height",
"keyword":"Then ",
"line":20,
"match":{
"location":"BoobarSteps.Z()"
}
}
],
"type":"scenario"
},
{
"id":"some-feature;teardown",
"tags":[
{
"name":"@TEARDOWN11",
"line":22
}
],
"description":"",
"name":"Teardown",
"keyword":"Scenario",
"line":23,
"type":"scenario"
}
],
"uri":"com\foobar\stories\mytests.feature"
}
]

My pom.xml looks as follows:

org.apache.maven.plugins
maven-failsafe-plugin
2.12


**/AllStories.java

${project.build.sourceDirectory}
${project.build.outputDirectory}
${project.build.outputDirectory}/failsafe-reports

${project.build.sourceDirectory}/resources




integration-test

integration-test
verify



Test looks as follows:
@RunWith(Cucumber.class)
@Cucumber.Options(tags = { "@wip", "@broken" }, strict = true, format = { "pretty", "html:target/cucumber", "json:target/cucumber.json" })
public class AllStories { ... }

Can some please help me on this.

Thanks.

@PranavPatil
Copy link
Author

I finally was able to figure this out.
In the feature i was writing the setup and teardown scenarios something as below.
Such scenarios run in cucumber-jvm 1.0.14 but when tried to generate a report it gave the
above NullPointerException.

@setup
Scenario: Setup.

Scenario: Customer account is added.
Given a customer with the name "abc"
When admin tries to create an account
Then get an customer account id which is not null and greater than zero

.........

@teardown
Scenario: Teardown

Fixed it by:

@setup
Scenario: Setup.
Given Something

Scenario: Customer account is added.
Given a customer with the name "abc"
When admin tries to create an account
Then get an customer account id which is not null and greater than zero

.........

@teardown
Scenario: Teardown
Given Something

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant