package org.jbehave.examples.core.meta; import static org.jbehave.core.io.CodeLocations.codeLocationFromClass; import static org.jbehave.core.reporters.Format.CONSOLE; import static org.jbehave.core.reporters.Format.HTML; import java.util.List; import org.jbehave.core.Embeddable; import org.jbehave.core.configuration.Configuration; import org.jbehave.core.configuration.MostUsefulConfiguration; import org.jbehave.core.embedder.StoryControls; import org.jbehave.core.io.CodeLocations; import org.jbehave.core.io.LoadFromClasspath; import org.jbehave.core.io.StoryFinder; import org.jbehave.core.junit.JUnitStories; import org.jbehave.core.reporters.StoryReporterBuilder; import org.jbehave.core.steps.InjectableStepsFactory; import org.jbehave.core.steps.spring.SpringApplicationContextFactory; import org.jbehave.core.steps.spring.SpringStepsFactory; import org.springframework.context.ApplicationContext; public class MetaByRowStories extends JUnitStories { @Override public Configuration configuration() { Class<? extends Embeddable> embeddableClass = this.getClass(); return new MostUsefulConfiguration().useStoryLoader(new LoadFromClasspath(embeddableClass)) .useStoryControls(new StoryControls().doMetaByRow(true)) .useStoryReporterBuilder( new StoryReporterBuilder() .withCodeLocation(CodeLocations.codeLocationFromClass(embeddableClass)) .withDefaultFormats().withFormats(CONSOLE, HTML).withFailureTrace(true) .withFailureTraceCompression(true)); } @Override public InjectableStepsFactory stepsFactory() { return new SpringStepsFactory(configuration(), createContext()); } protected ApplicationContext createContext() { return new SpringApplicationContextFactory("org/jbehave/examples/core/meta/steps.xml") .createApplicationContext(); } @Override protected List<String> storyPaths() { return new StoryFinder().findPaths(codeLocationFromClass(this.getClass()), "**/*.story", ""); } }