damianszczepanik / cucumber-reporting

HTML reports for Cucumber
GNU Lesser General Public License v2.1
548 stars 403 forks source link

A cucumber pending exception step results in a NullPointerException being thrown #59

Closed restagner closed 9 years ago

restagner commented 10 years ago

I have a step that contains within it the following:

Given(~'^an unregistered user has successfully registered$') { ->
    throw new PendingException("""\
        | Unable to run the scenario until test code has been implemented to register an unregistered user""".stripMargin())
}

However, when I run mvn clean verify, the end result is a java.lang.NullPointerException. Here is a copy of the stacktrace

[ERROR] Failed to execute goal net.masterthought:maven-cucumber-reporting:0.0.3:generate (execution) on project dnote-acceptance-tests: Error Found: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal net.masterthought:maven-cucumber-reporting:0.0.3:generate (execution) on project dnote-acceptance-tests: Error Found:
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error Found:
        at net.masterthought.cucumber.CucumberReportGeneratorMojo.execute(CucumberReportGeneratorMojo.java:70)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        ... 19 more
Caused by: java.lang.NullPointerException
        at net.masterthought.cucumber.json.Step$predicates$1.matches(Step.java:171)
        at net.masterthought.cucumber.json.Step$predicates$1.matches(Step.java:168)
        at com.googlecode.totallylazy.iterators.FilterIterator.getNext(FilterIterator.java:20)
        at com.googlecode.totallylazy.iterators.StatefulIterator.hasNext(StatefulIterator.java:23)
        at com.googlecode.totallylazy.Iterators.size(Iterators.java:347)
        at com.googlecode.totallylazy.Sequences.size(Sequences.java:384)
        at com.googlecode.totallylazy.Sequence.size(Sequence.java:245)
        at net.masterthought.cucumber.json.Element.getStatus(Element.java:36)
        at net.masterthought.cucumber.ReportInformation.processFeatures(ReportInformation.java:225)
        at net.masterthought.cucumber.ReportInformation.<init>(ReportInformation.java:41)
        at net.masterthought.cucumber.ReportBuilder.<init>(ReportBuilder.java:39)
        at net.masterthought.cucumber.CucumberReportGeneratorMojo.execute(CucumberReportGeneratorMojo.java:61)
        ... 21 more

And, here is a copy of the generated cucumber.json file

[
  {
    "id": "login",
    "description": "As a DNOTE user\r\nI want to be able to login inside or outside of the network\r\nSo that I can do my job from home when needed",
    "name": "Login",
    "keyword": "Feature",
    "line": 1,
    "elements": [
      {
        "after": [
          {
            "result": {
              "duration": 267555648,
              "status": "passed"
            },
            "match": {
              "location": "env.groovy:35"
            }
          }
        ],
        "id": "login;a-newly-registered-user-logs-in-for-the-first-time",
        "tags": [
          {
            "name": "@US10842",
            "line": 19
          },
          {
            "name": "@pending_fix",
            "line": 19
          }
        ],
        "before": [
          {
            "result": {
              "duration": 3300185224,
              "status": "passed"
            },
            "match": {
              "location": "env.groovy:30"
            }
          }
        ],
        "description": "",
        "name": "A newly registered user logs in for the first time",
        "keyword": "Scenario",
        "line": 20,
        "steps": [
          {
            "result": {
              "duration": 136247996,
              "status": "pending",
              "error_message": "cucumber.api.PendingException:  Unable to run the scenario until test code has been implemented to register an unregistered user\r\n\tat sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)\r\n\tat sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)\r\n\tat sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)\r\n\tat java.lang.reflect.Constructor.newInstance(Constructor.java:526)\r\n\tat org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)\r\n\tat org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)\r\n\tat org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)\r\n\tat org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)\r\n\tat org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)\r\n\tat studiotech.steps.LoginSteps$_run_closure3.doCall(LoginSteps.groovy:16)\r\n\tat ✽.Given an unregistered user has successfully registered(features\\login.feature:21)\r\n"
            },
            "name": "an unregistered user has successfully registered",
            "keyword": "Given ",
            "line": 21,
            "match": {
              "location": "LoginSteps.groovy:15"
            }
          },
          {
            "result": {
              "status": "skipped"
            },
            "name": "the user has been granted access",
            "keyword": "And ",
            "line": 22,
            "match": {
              "location": "LoginSteps.groovy:20"
            }
          },
          {
            "result": {
              "status": "skipped"
            },
            "name": "the user logs in with their credentials",
            "keyword": "When ",
            "line": 23,
            "match": {
              "location": "LoginSteps.groovy:50"
            }
          },
          {
            "result": {
              "status": "skipped"
            },
            "name": "the home page shall be displayed",
            "keyword": "Then ",
            "line": 24,
            "match": {
              "location": "LoginSteps.groovy:63"
            }
          }
        ],
        "type": "scenario"
      }
    ],
    "uri": "features\\login.feature"
  }
]
kingsleyh commented 10 years ago

Hi

I think this problem is fixed in version 0.0.6 - try that : http://www.masterthought.net/section/cucumber-reporting-downloads

--K

On 17 Apr 2014, at 17:00, restagner notifications@github.com wrote:

I have a step that contains within it the following:

Given(~'^an unregistered user has successfully registered$') { -> throw new PendingException("""\ | Unable to run the scenario until test code has been implemented to register an unregistered user""".stripMargin()) } However, when I run mvn clean verify, the end result is a java.lang.NullPointerException. Here is a copy of the stacktrace

[ERROR] Failed to execute goal net.masterthought:maven-cucumber-reporting:0.0.3:generate (execution) on project dnote-acceptance-tests: Error Found: NullPointerException -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal net.masterthought:maven-cucumber-reporting:0.0.3:generate (execution) on project dnote-acceptance-tests: Error Found: at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) Caused by: org.apache.maven.plugin.MojoExecutionException: Error Found: at net.masterthought.cucumber.CucumberReportGeneratorMojo.execute(CucumberReportGeneratorMojo.java:70) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) ... 19 more Caused by: java.lang.NullPointerException at net.masterthought.cucumber.json.Step$predicates$1.matches(Step.java:171) at net.masterthought.cucumber.json.Step$predicates$1.matches(Step.java:168) at com.googlecode.totallylazy.iterators.FilterIterator.getNext(FilterIterator.java:20) at com.googlecode.totallylazy.iterators.StatefulIterator.hasNext(StatefulIterator.java:23) at com.googlecode.totallylazy.Iterators.size(Iterators.java:347) at com.googlecode.totallylazy.Sequences.size(Sequences.java:384) at com.googlecode.totallylazy.Sequence.size(Sequence.java:245) at net.masterthought.cucumber.json.Element.getStatus(Element.java:36) at net.masterthought.cucumber.ReportInformation.processFeatures(ReportInformation.java:225) at net.masterthought.cucumber.ReportInformation.(ReportInformation.java:41) at net.masterthought.cucumber.ReportBuilder.(ReportBuilder.java:39) at net.masterthought.cucumber.CucumberReportGeneratorMojo.execute(CucumberReportGeneratorMojo.java:61) ... 21 more

And, here is a copy of the generated cucumber.json file

[ { "id": "login", "description": "As a DNOTE user\r\nI want to be able to login inside or outside of the network\r\nSo that I can do my job from home when needed", "name": "Login", "keyword": "Feature", "line": 1, "elements": [ { "after": [ { "result": { "duration": 267555648, "status": "passed" }, "match": { "location": "env.groovy:35" } } ], "id": "login;a-newly-registered-user-logs-in-for-the-first-time", "tags": [ { "name": "@US10842", "line": 19 }, { "name": "@pending_fix", "line": 19 } ], "before": [ { "result": { "duration": 3300185224, "status": "passed" }, "match": { "location": "env.groovy:30" } } ], "description": "", "name": "A newly registered user logs in for the first time", "keyword": "Scenario", "line": 20, "steps": [ { "result": { "duration": 136247996, "status": "pending", "error_message": "cucumber.api.PendingException: Unable to run the scenario until test code has been implemented to register an unregistered user\r\n\tat sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)\r\n\tat sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)\r\n\tat sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)\r\n\tat java.lang.reflect.Constructor.newInstance(Constructor.java:526)\r\n\tat org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)\r\n\tat org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)\r\n\tat org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)\r\n\tat org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)\r\n\tat org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)\r\n\tat studiotech.steps.LoginSteps$_run_closure3.doCall(LoginSteps.groovy:16)\r\n\tat ✽.Given an unregistered user has successfully registered(features\login.feature:21)\r\n" }, "name": "an unregistered user has successfully registered", "keyword": "Given ", "line": 21, "match": { "location": "LoginSteps.groovy:15" } }, { "result": { "status": "skipped" }, "name": "the user has been granted access", "keyword": "And ", "line": 22, "match": { "location": "LoginSteps.groovy:20" } }, { "result": { "status": "skipped" }, "name": "the user logs in with their credentials", "keyword": "When ", "line": 23, "match": { "location": "LoginSteps.groovy:50" } }, { "result": { "status": "skipped" }, "name": "the home page shall be displayed", "keyword": "Then ", "line": 24, "match": { "location": "LoginSteps.groovy:63" } } ], "type": "scenario" } ], "uri": "features\login.feature" } ] — Reply to this email directly or view it on GitHub.

restagner commented 10 years ago

@kingsleyh That seems to have worked :+1:

However, after upgrading to cucumber-reporting, version 0.0.23 and maven-cucumber-reporting, version 0.0.6, I'm seeing the following:

Downloading: https://tech.studio.disney.com/artifactory/repo/com/googlecode/totallylazy/totallylazy/1077/totallylazy-1077.pom
[WARNING] The POM for com.googlecode.totallylazy:totallylazy:jar:1077 is missing, no dependency information available

Is there an additional dependency that I may have overlooked?

kingsleyh commented 10 years ago

yeah - the totallylazy stuff is on an independent repository not on an official sonatype/nexus maven repo. So probably the list of repositories your mvn looks in is restricted to your internal repository location. A lot of places also provide the official maven repos as a fallback if not found on the company internal one - and perhaps copies across to the internal one automatically - however totally lazy is not on any of those.

However from the message you posted - it looks like it's only trying to download from your internal repository - which doesn't have the totallylazy jars. So you have a few options:

  1. upload the totallylazy jars to your internal repository
  2. authorise the totally lazy repo as a valid location to check for jars in your repository setup
  3. download the jars locally to your local .m2 directory anywhere that needs to access it
  4. it may work if you just include totally lazy as a mvn dependency in your project

for reference here is the repo and mvn dependency:

repo.bodar.com http://repo.bodar.com

com.googlecode.totallylazy totallylazy 1077

hope that helps

--K

On 17 Apr 2014, at 17:40, restagner notifications@github.com wrote:

@kingsleyh That seems to have worked

However, after upgrading to cucumber-reporting, version 0.0.23 and maven-cucumber-reporting, version 0.0.6, I'm seeing the following:

Downloading: https://tech.studio.disney.com/artifactory/repo/com/googlecode/totallylazy/totallylazy/1077/totallylazy-1077.pom [WARNING] The POM for com.googlecode.totallylazy:totallylazy:jar:1077 is missing, no dependency information available Is there an additional dependency that I may have overlooked?

— Reply to this email directly or view it on GitHub.

restagner commented 10 years ago

Thanks for the information!! I went ahead with option 1.

On Thu, Apr 17, 2014 at 10:41 AM, Kingsley Hendrickse < notifications@github.com> wrote:

yeah - the totallylazy stuff is on an independent repository not on an official sonatype/nexus maven repo. So probably the list of repositories your mvn looks in is restricted to your internal repository location. A lot of places also provide the official maven repos as a fallback if not found on the company internal one - and perhaps copies across to the internal one automatically - however totally lazy is not on any of those.

However from the message you posted - it looks like it's only trying to download from your internal repository - which doesn't have the totallylazy jars. So you have a few options:

  1. upload the totallylazy jars to your internal repository
  2. authorise the totally lazy repo as a valid location to check for jars in your repository setup
  3. download the jars locally to your local .m2 directory anywhere that needs to access it
  4. it may work if you just include totally lazy as a mvn dependency in your project

for reference here is the repo and mvn dependency:

repo.bodar.com http://repo.bodar.com

com.googlecode.totallylazy totallylazy 1077

hope that helps

--K

On 17 Apr 2014, at 17:40, restagner notifications@github.com wrote:

@kingsleyh That seems to have worked

However, after upgrading to cucumber-reporting, version 0.0.23 and maven-cucumber-reporting, version 0.0.6, I'm seeing the following:

Downloading: https://tech.studio.disney.com/artifactory/repo/com/googlecode/totallylazy/totallylazy/1077/totallylazy-1077.pom [WARNING] The POM for com.googlecode.totallylazy:totallylazy:jar:1077 is missing, no dependency information available Is there an additional dependency that I may have overlooked?

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHubhttps://github.com/masterthought/cucumber-reporting/issues/59#issuecomment-40741371 .

Regards, Robert