user1772643
user1772643

Reputation: 645

org.jbehave.core.io.storyresourcenotfound exception when running jbehave test in eclipse

I am getting this exception when I run the IT test written jbehave in eclipse.

org.jbehave.core.io.storyresourcenotfound 

I have path_steps.java and path_story.java in test/java/package and path.story file in the same package in test/resources/package.

Not sure what needs to be changed.

Upvotes: 4

Views: 7428

Answers (1)

Michael Osofsky
Michael Osofsky

Reputation: 13115

I'm not sure if my context was the same as yours, but in my case the problem was a typo in my steps file. I had a Then condition with two parameters but my method signature in my Steps.java file was missing one of them. I corrected the mistake and my tests passed successfully.

Here's what the error was that I was getting:

[INFO] Using controls UnmodifiableEmbedderControls[EmbedderControls[batch=false,skip=false,generateViewAfterStories=true,ignoreFailureInStories=true,ignoreFailureInView=false,verboseFailures=false,verboseFiltering=false,storyTimeoutInSecs=300,failOnStoryTimeout=false,threads=1]]

(BeforeStories)

[INFO] Running story com/netbase/OpMetricsFilterBuilder/stories/ComputeDerivedValue.story
Compute Derived Value
(com/netbase/OpMetricsFilterBuilder/stories/ComputeDerivedValue.story)
Narrative:
In order to explore how my social media activity ties to my core business metrics
As a n analyst
I want to compute a derived time series value from a set of component time series
Scenario: Compute Net Intent to Shop
Given the following time series:

|Date|Shop|NotShop|
|11/5/2014|330|400|
|11/6/2014|370|410|
|11/7/2014|320|390|
|11/8/2014|200|280|
|11/9/2014|430|450|

And a derived value name of NetIntentToShop
And a formula for computing the derived value is (#{Shop} - #{NotShop}) / (#{Shop} + #{NotShop}) * 100
When the NetIntentToShop is derived
Then the NetIntentToShop should be
|Date|NetIntentToShop|
|11/5/2014|-9.58904109589041|
|11/6/2014|-5.128205128205128|
|11/7/2014|-9.859154929577464|
|11/8/2014|-16.666666666666664|
|11/9/2014|-2.272727272727273| (FAILED)
(org.jbehave.core.io.StoryResourceNotFound: Story path 'NetIntentToShop' not found by class loader EmbedderClassLoader[urls=[/Users/mosofsky/Developer/SocialMetrics/nbsocialmetrics-frontend/target/classes/, appengine-api-1.0-sdk-1.9.15.jar, servlet-api-2.5.jar, jstl-1.2.jar, objectify-5.1.1.jar, guava-17.0.jar, jeval-0.9.4.jar, gwt-user-2.7.0-rc1.jar, validation-api-1.0.0.GA.jar, validation-api-1.0.0.GA-sources.jar, gwt-dev-2.7.0-rc1.jar, asm-5.0.3.jar, asm-util-5.0.3.jar, asm-tree-5.0.3.jar, asm-commons-5.0.3.jar, jbehave-core-3.9.5.jar, hamcrest-integration-1.3.jar, commons-collections-3.2.1.jar, commons-io-2.4.jar, commons-lang-2.6.jar, plexus-utils-3.0.10.jar, freemarker-2.3.19.jar, paranamer-2.4.jar, xstream-1.4.5.jar, xmlpull-1.1.3.1.jar, xpp3_min-1.1.4c.jar, jbehave-junit-runner-1.1.2.jar, junit-4.11.jar, mockito-core-1.9.5.jar, hamcrest-core-1.3.jar, hamcrest-library-1.3.jar, objenesis-1.3.jar],parent=ClassRealm[plugin>org.jbehave:jbehave-maven-plugin:3.9.5, parent: sun.misc.Launcher$AppClassLoader@6da21389]])


[WARNING] Failed to run story com/netbase/OpMetricsFilterBuilder/stories/ComputeDerivedValue.story
org.jbehave.core.io.StoryResourceNotFound: Story path 'NetIntentToShop' not found by class loader EmbedderClassLoader[urls=[/Users/mosofsky/Developer/SocialMetrics/nbsocialmetrics-frontend/target/classes/, appengine-api-1.0-sdk-1.9.15.jar, servlet-api-2.5.jar, jstl-1.2.jar, objectify-5.1.1.jar, guava-17.0.jar, jeval-0.9.4.jar, gwt-user-2.7.0-rc1.jar, validation-api-1.0.0.GA.jar, validation-api-1.0.0.GA-sources.jar, gwt-dev-2.7.0-rc1.jar, asm-5.0.3.jar, asm-util-5.0.3.jar, asm-tree-5.0.3.jar, asm-commons-5.0.3.jar, jbehave-core-3.9.5.jar, hamcrest-integration-1.3.jar, commons-collections-3.2.1.jar, commons-io-2.4.jar, commons-lang-2.6.jar, plexus-utils-3.0.10.jar, freemarker-2.3.19.jar, paranamer-2.4.jar, xstream-1.4.5.jar, xmlpull-1.1.3.1.jar, xpp3_min-1.1.4c.jar, jbehave-junit-runner-1.1.2.jar, junit-4.11.jar, mockito-core-1.9.5.jar, hamcrest-core-1.3.jar, hamcrest-library-1.3.jar, objenesis-1.3.jar],parent=ClassRealm[plugin>org.jbehave:jbehave-maven-plugin:3.9.5, parent: sun.misc.Launcher$AppClassLoader@6da21389]]
    at org.jbehave.core.io.LoadFromClasspath.resourceAsStream(LoadFromClasspath.java:44)
    at org.jbehave.core.io.LoadFromClasspath.loadResourceAsText(LoadFromClasspath.java:29)
    at org.jbehave.core.model.ExamplesTableFactory.createExamplesTable(ExamplesTableFactory.java:76)
    at org.jbehave.core.steps.ParameterConverters$ExamplesTableConverter.convertValue(ParameterConverters.java:647)
    at org.jbehave.core.steps.ParameterConverters.convert(ParameterConverters.java:151)
    at org.jbehave.core.steps.StepCreator.convertParameterValues(StepCreator.java:304)
    at org.jbehave.core.steps.StepCreator.access$1100(StepCreator.java:36)
    at org.jbehave.core.steps.StepCreator$ParametrisedStep.parametriseStep(StepCreator.java:640)
    at org.jbehave.core.steps.StepCreator$ParametrisedStep.perform(StepCreator.java:592)
    at org.jbehave.core.embedder.StoryRunner$FineSoFar.run(StoryRunner.java:535)
    at org.jbehave.core.embedder.StoryRunner.runStepsWhileKeepingState(StoryRunner.java:515)
    at org.jbehave.core.embedder.StoryRunner.runScenarioSteps(StoryRunner.java:479)
    at org.jbehave.core.embedder.StoryRunner.runStepsWithLifecycle(StoryRunner.java:445)
    at org.jbehave.core.embedder.StoryRunner.runCancellable(StoryRunner.java:305)
    at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:220)
    at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:181)
    at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:262)
    at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:229)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

Here's the erroneous method signature:

@Then("the $derivedValueName should be: $expectedOutputDataTable")
public void thenTheDerivedValueShouldBe(ExamplesTable expectedOutputDataTable) {

Here's the correction:

@Then("the $derivedValueName should be: $expectedOutputDataTable")
public void thenTheDerivedValueShouldBe(String derivedValueName, ExamplesTable expectedOutputDataTable) {

It seems like a funny error message for my situation. I guess if a parameter is missing from the Steps.java file then Jbehave might go search for it as a resource.

Upvotes: 1

Related Questions