gpt4 book ai didi

java - 在 eclipse 中运行 jbehave 测试时出现 org.jbehave.core.io.storyresourcenotfound 异常

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:09:36 28 4
gpt4 key购买 nike

当我运行在 eclipse 中编写的 jbehave IT 测试时出现此异常。

org.jbehave.core.io.storyresourcenotfound 

我在 test/java/package 中有 path_steps.java 和 path_story.java,在 test/resources/package 中的同一个包中有 path.story 文件。

不确定需要更改什么。

最佳答案

我不确定我的上下文是否与您的相同,但就我而言,问题是我的步骤文件中的拼写错误。我有一个带有两个参数的 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 可能会去搜索它作为资源。

关于java - 在 eclipse 中运行 jbehave 测试时出现 org.jbehave.core.io.storyresourcenotfound 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15727049/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com