当我在eclipse中运行编写jbehave的IT测试时,我遇到了这个异常。
org.jbehave.core.io.storyresourcenotfound
test / java / package中的path_steps.java和path_story.java以及test / resources / package中相同包中的path.story文件。
不确定需要更改的内容。
答案 0 :(得分:1)
我不确定我的上下文是否与您的相同,但在我的情况下,问题是我的步骤文件中的拼写错误。我有一个带有两个参数的Then
条件但我的Steps.java
文件中的方法签名缺少其中一个。我纠正了错误,我的测试成功通过。
这是我得到的错误:
[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)
这是错误的方法签名:
@Then("the $derivedValueName should be: $expectedOutputDataTable")
public void thenTheDerivedValueShouldBe(ExamplesTable expectedOutputDataTable) {
以下是更正:
@Then("the $derivedValueName should be: $expectedOutputDataTable")
public void thenTheDerivedValueShouldBe(String derivedValueName, ExamplesTable expectedOutputDataTable) {
对于我的情况,这似乎是一个有趣的错误消息。我想如果Steps.java
文件中缺少参数,那么Jbehave可能会将其作为资源进行搜索。