-
Notifications
You must be signed in to change notification settings - Fork 53
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
NPE when getting the Story on CrossReference.java (story not setup for CrossReference) #8
Comments
Hi, I assume that with fixing Issue #9 I also fixed this one. Since I am not using the Selenium Web and also no CrossReferences yet, I found it hard to reproduce the NPE. Please download the latest 1.0.0-SNAPSHOT or get it as maven dependency from https://oss.sonatype.org/content/repositories/snapshots/de/codecentric/jbehave-junit-runner/1.0.0-SNAPSHOT. Thanks! |
Hi, could you please let me know, if your bug is fixed? You can get the final 1.0.0 release of the library frrom maven central. Andreas |
Hello, In both instances I get the same error reported above: java.lang.NullPointerException: story not setup for CrossReference
at org.jbehave.core.reporters.CrossReference$XRefStepMonitor.stepMatchesPattern(CrossReference.java:228)
at org.jbehave.core.steps.DelegatingStepMonitor.stepMatchesPattern(DelegatingStepMonitor.java:25)
at org.jbehave.core.steps.StepCandidate.matches(StepCandidate.java:135)
at de.codecentric.jbehave.junit.monitoring.JUnitDescriptionGenerator.findMatchingStep(JUnitDescriptionGenerator.java:145)
at de.codecentric.jbehave.junit.monitoring.JUnitDescriptionGenerator.addSteps(JUnitDescriptionGenerator.java:110)
at de.codecentric.jbehave.junit.monitoring.JUnitDescriptionGenerator.addScenarioSteps(JUnitDescriptionGenerator.java:103)
at de.codecentric.jbehave.junit.monitoring.JUnitDescriptionGenerator.createDescriptionFrom(JUnitDescriptionGenerator.java:63)
at de.codecentric.jbehave.junit.monitoring.JUnitDescriptionGenerator.createDescriptionFrom(JUnitDescriptionGenerator.java:47)
at de.codecentric.jbehave.junit.monitoring.JUnitReportingRunner.buildDescriptionFromStories(JUnitReportingRunner.java:108)
at de.codecentric.jbehave.junit.monitoring.JUnitReportingRunner.<init>(JUnitReportingRunner.java:61)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) |
Hm, ok, I will try to reproduce this. If this is not too much work, could you provide a sample without Selenium? Just to keep it simple :) |
Hi, I could reproduce the error. Fixing it is a different question, but it should not be impossible ... I hope :) The "problem" is that while generating the test descriptions for JUnit, the step monitor tries to report that it found a matching step, which then notifies also the CrossReference, which is not completely setup at that point. Also, I wonder if the cross-reference should be notified at all, in this stage. We'll see :) Andreas |
Hi, could you please check if the latest 1.0.1-SNAPSHOT fixes this issue? There's still some cleaning up todo in the code, but I hope it's working now. Andreas |
Hi Andreas, java.lang.NullPointerException: story not setup for CrossReference
at org.jbehave.core.reporters.CrossReference$XRefStepMonitor.stepMatchesPattern(CrossReference.java:228)
at org.jbehave.core.steps.DelegatingStepMonitor.stepMatchesPattern(DelegatingStepMonitor.java:25)
at org.jbehave.core.steps.StepCandidate.matches(StepCandidate.java:135)
at de.codecentric.jbehave.junit.monitoring.JUnitDescriptionGenerator.findMatchingStep(JUnitDescriptionGenerator.java:145)
at de.codecentric.jbehave.junit.monitoring.JUnitDescriptionGenerator.addSteps(JUnitDescriptionGenerator.java:110)
at de.codecentric.jbehave.junit.monitoring.JUnitDescriptionGenerator.addScenarioSteps(JUnitDescriptionGenerator.java:103)
at de.codecentric.jbehave.junit.monitoring.JUnitDescriptionGenerator.insertDescriptionForExamples(JUnitDescriptionGenerator.java:97)
at de.codecentric.jbehave.junit.monitoring.JUnitDescriptionGenerator.createDescriptionFrom(JUnitDescriptionGenerator.java:61)
at de.codecentric.jbehave.junit.monitoring.JUnitDescriptionGenerator.createDescriptionFrom(JUnitDescriptionGenerator.java:47)
at de.codecentric.jbehave.junit.monitoring.JUnitReportingRunner.buildDescriptionFromStories(JUnitReportingRunner.java:108)
at de.codecentric.jbehave.junit.monitoring.JUnitReportingRunner.<init>(JUnitReportingRunner.java:61)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) |
Hi, the line numbers in the stack trace don't match the latest version, that I commited. Can you please check which SNAPSHOT-version you got? The latest Snapshot (jbehave-junit-runner-1.0.1-20120522.180232-8.jar) is either available from this repository: https://oss.sonatype.org/content/repositories/snapshots/de/codecentric/jbehave-junit-runner/ Or from the downloads https://github.com/codecentric/jbehave-junit-runner/downloads I just doublechecked that in both places the latest version is available. Thanks! Andreas |
You are completely right, I picked up the 5/18 instead of the 5/22 version. The latest did fix this issue. I did run into some a different problem when using "GivenStories". I'll open a new issue for it. Thanks a lot for the help you guys rock! |
Thank you! That makes me smile -> :) Also good, that this issue is fixed. Because if it weren't, I had no idea, what to do next ;) |
Makes me smile too :) <!-- slf4j-api is automatically included by logback-classic with runtime scope
I think this dependency below will be required if we start using slf4j logging in our code
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.4</version>
</dependency>
-->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>runtime</scope>
<version>1.0.3</version>
</dependency> |
To reproduce:
Have a class extending JUnitStories with the following configuration:
When you run you'll get the following stack trace:
Seems like when calling CrossReference.stepMatchesPattern(), the call to
Story story = currentStory.get();
Returns a null story, so maybe currentStory was never initialized
The text was updated successfully, but these errors were encountered: