问题
I have been following lot of posts & threads based on which have integrated the logic to skip scenarios. Still not able to get it working successfully. When i put the "configuredEmbedder().useMetaFilters(Arrays.asList("-skip"));" OR "configuredEmbedder().useMetaFilters(Arrays.asList("+skip"));" in the storyrunner,java file, none of the scenarios are executed. And when I remove the line, all the scenarios are executed. My .story file has "Meta skip" in 2 of the 4 scenarios. Can someone please look into this & let me know what I may have missed.
Below is the class where all the configs reside public class SampleStory extends JUnitStory {
public SampleStory() {
configuredEmbedder().embedderControls()
.doGenerateViewAfterStories(true)
.doIgnoreFailureInStories(false).doIgnoreFailureInView(true)
.useStoryTimeoutInSecs(60);
configuredEmbedder().useMetaFilters(Arrays.asList("+skip"));
/* removeStartIgnoreCase */
// StringUtils.removeStartIgnoreCase("","");
}
@Override
public Configuration configuration() {
Configuration configuration = new MostUsefulConfiguration();
Properties viewResources = new Properties();
viewResources.put("decorateNonHtml", "true");
viewResources.put("reports", "ftl/jbehave-reports-with-totals.ftl");
// Where to find the stories
StoryLoader storyLoader;
storyLoader = new LoadFromRelativeFile(
CodeLocations.codeLocationFromClass(this.getClass()));
configuration.useStoryLoader(storyLoader);
StoryReporterBuilder storyReporterBuilder;
storyReporterBuilder = new StoryReporterBuilder();
// storyReporterBuilder.withDefaultFormats();
storyReporterBuilder.withDefaultFormats();
// storyReporterBuilder.withViewResources(viewResources).withFormats(CONSOLE,
// TXT, HTML, XML);
// storyReporterBuilder.withFormats();
// CONSOLE reporting
configuration.useStoryReporterBuilder(storyReporterBuilder);
return configuration;
}
/*
* @Override public Embedder configuredEmbedder() {
* super.configuredEmbedder().useMetaFilters(Arrays.asList("-skip"));
*
*
* return super.configuredEmbedder(); }
*/
@Override
public InjectableStepsFactory stepsFactory() {
return new InstanceStepsFactory(configuration(), new SampleSteps());
}
Snenairo.story
Scenario: This is scenario 1
Given I say hello
When I say bye
Then whatever
Scenario: This is scenario 2
Meta : @skip
Given I say ello
When I say ye
Then whatever
There is another class where all the binding menthods for g/w/t exists.
回答1:
Got an reply from the group of the devs of jbehave - there was a syntax error i did meta: @skip but it should have been meta : @skip
回答2:
I used @ignore
like this in my jbehave scenario and it worked.
Scenario: Employee1 - Delete Employees
Meta:
@ignore
来源:https://stackoverflow.com/questions/21683139/not-able-to-skip-scenarios-in-jbehave-with-junitstory