Java JBehave junit测试输出分组
目前,我正在尝试使用JBehave和JUnitStory进行一些BDD,如下所示Java JBehave junit测试输出分组,java,bdd,jbehave,Java,Bdd,Jbehave,目前,我正在尝试使用JBehave和JUnitStory进行一些BDD,如下所示 import org.jbehave.core.configuration.Configuration; import org.jbehave.core.configuration.MostUsefulConfiguration; import org.jbehave.core.junit.JUnitStory; import org.jbehave.core.steps.InjectableStepsFactor
import org.jbehave.core.configuration.Configuration;
import org.jbehave.core.configuration.MostUsefulConfiguration;
import org.jbehave.core.junit.JUnitStory;
import org.jbehave.core.steps.InjectableStepsFactory;
import org.jbehave.core.steps.InstanceStepsFactory;
public class MyStory extends JUnitStory {
@Override
public Configuration configuration() {
return new MostUsefulConfiguration()
.useStoryLoader(new MyStoryLoader("src\\main\\resources\\hello.story"));
}
@Override
public InjectableStepsFactory stepsFactory() {
return new InstanceStepsFactory(configuration(), new MySteps());
}
}
我的问题是,即使我的step文件包含多个场景,junit输出也不按场景分组。你能告诉我怎么做吗
我的step文件如下
Narrative:
In order to find items that I would like to purchase
As a potential buyer
I want to be able to search for items containing certain words
Scenario: Should list items related to a specified keyword
Given The "XXXX" is initiated as
|Description|Value|Matcher|Verified|
|Value1|Value1|"Value1"|Yes|
|Value2|Value2|"ValueX"|No|
When The "YYYY" submission is invoked as
|Description|Value|Matcher|Verified|
|Value1|Value1|"Value1"|Yes|
|Value2|Value2|"ValueX"|No|
Then The "ZZZZ" should be
|Description|Value|Matcher|Verified|
|Value1|Value1|"Value1"|Yes|
|Value2|Value2|"ValueX"|No|
Scenario: Should be able to filter search results by item type
Given The "XXXX" is initiated as
|Description|Value|Matcher|Verified|
|Value1|Value1|"Value1"|Yes|
|Value2|Value2|"ValueX"|No|
When The "YYYY" submission is invoked as
|Description|Value|Matcher|Verified|
|Value1|Value1|"Value1"|Yes|
|Value2|Value2|"ValueX"|No|
Then The "ZZZZ" should be
|Description|Value|Matcher|Verified|
|Value1|Value1|"Value1"|Yes|
|Value2|Value2|"ValueX"|No|
当前结果窗格如下所示
import org.jbehave.core.configuration.Configuration;
import org.jbehave.core.configuration.MostUsefulConfiguration;
import org.jbehave.core.junit.JUnitStory;
import org.jbehave.core.steps.InjectableStepsFactory;
import org.jbehave.core.steps.InstanceStepsFactory;
public class MyStory extends JUnitStory {
@Override
public Configuration configuration() {
return new MostUsefulConfiguration()
.useStoryLoader(new MyStoryLoader("src\\main\\resources\\hello.story"));
}
@Override
public InjectableStepsFactory stepsFactory() {
return new InstanceStepsFactory(configuration(), new MySteps());
}
}
我只想按场景对输出进行分类为此目的使用JBehave JUnit runner: 输出示例: