Skip to content

Instantly share code, notes, and snippets.

@eliasnogueira
Last active August 29, 2015 13:56
Show Gist options
  • Save eliasnogueira/9097811 to your computer and use it in GitHub Desktop.
Save eliasnogueira/9097811 to your computer and use it in GitHub Desktop.
StoryBase para JBehave em Java
import java.util.List;
import org.jbehave.core.configuration.Configuration;
import org.jbehave.core.configuration.MostUsefulConfiguration;
import org.jbehave.core.io.CodeLocations;
import org.jbehave.core.io.LoadFromClasspath;
import org.jbehave.core.io.StoryFinder;
import org.jbehave.core.junit.JUnitStory;
import org.jbehave.core.reporters.StoryReporterBuilder;
import org.jbehave.core.steps.InstanceStepsFactory;
public class StoryBase extends JUnitStory {
@Override
public Configuration configuration() {
return new MostUsefulConfiguration()
.useStoryLoader(new LoadFromClasspath(this.getClass()))
.useStoryReporterBuilder(new StoryReporterBuilder()
.withDefaultFormats());
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public List candidateSteps() {
return new InstanceStepsFactory(configuration(), this).createCandidateSteps();
}
protected List<String> storyPaths() {
return new StoryFinder().findPaths(CodeLocations.codeLocationFromClass(this.getClass()), "**/*.story", "");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment