我正在使用JBehave 3.9.5和JUnitReportingRunner 1.2.0,在Jenkins中运行。当一个场景失败时,我得到3个错误:一个用于步骤,一个用于场景,一个用于故事。在我的詹金斯报告中,这很令人困惑。我希望JBehava仅在场景级别上报告错误。这可能吗?
以下是我生成的surefire-reports
的相关部分 <testcase classname="java.lang.Object" name="BeforeStories" time="0.005"/>
<testcase classname="de.bulla.jbehave.SomeSteps" name="Given Doing a given step" time="0.002"/>
<testcase classname="de.bulla.jbehave.SomeSteps" name="When Doing a when step" time="0"/>
<testcase classname="de.bulla.jbehave.SomeSteps" name="Then Doing a then step" time="0.001"/>
<testcase classname="Scenario: Dieses Szenario ist erfolgreich" name="Scenario: Dieses Szenario ist erfolgreich" time="0.006"/>
<testcase classname="de.bulla.jbehave.SomeSteps" name="Given Doing a given step" time="0"/>
<testcase classname="de.bulla.jbehave.SomeSteps" name="When Doing a when step" time="0"/>
<testcase classname="de.bulla.jbehave.SomeSteps" name="Then Doing an epic fail" time="0.004">
<failure type="java.lang.AssertionError">java.lang.AssertionError
at org.junit.Assert.fail(Assert.java:86)
at org.junit.Assert.fail(Assert.java:95)
at de.bulla.jbehave.SomeSteps.anEpicFail(SomeSteps.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.jbehave.core.steps.StepCreator$ParametrisedStep.perform(StepCreator.java:595)
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:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
</failure>
<system-out>When Doing a when step
</system-out>
</testcase>
<testcase classname="Scenario: Und dieses schlaegt fehl" name="Scenario: Und dieses schlaegt fehl" time="0.01">
<failure message="scenario failed!" type="java.lang.AssertionError">java.lang.AssertionError: scenario failed!
at de.codecentric.jbehave.junit.monitoring.JUnitScenarioReporter.afterScenario(JUnitScenarioReporter.java:218)
at org.jbehave.core.reporters.DelegatingStoryReporter.afterScenario(DelegatingStoryReporter.java:43)
at org.jbehave.core.reporters.ConcurrentStoryReporter.afterScenario(ConcurrentStoryReporter.java:173)
at org.jbehave.core.embedder.StoryRunner.runCancellable(StoryRunner.java:316)
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:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
</failure>
<system-out>Then Doing an epic fail (FAILED)
(java.lang.AssertionError)
</system-out>
</testcase>
<testcase classname="testcase.story" name="testcase.story" time="0.01">
<failure message="story failed!" type="java.lang.AssertionError">java.lang.AssertionError: story failed!
at de.codecentric.jbehave.junit.monitoring.JUnitScenarioReporter.afterStory(JUnitScenarioReporter.java:143)
at org.jbehave.core.reporters.DelegatingStoryReporter.afterStory(DelegatingStoryReporter.java:49)
at org.jbehave.core.reporters.ConcurrentStoryReporter.afterStory(ConcurrentStoryReporter.java:119)
at org.jbehave.core.embedder.StoryRunner.runCancellable(StoryRunner.java:324)
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:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
</failure>
</testcase>
<testcase classname="java.lang.Object" name="AfterStories" time="0"/>
</testsuite>