use of org.jbehave.core.configuration.MostUsefulConfiguration in project jbehave-core by jbehave.
the class InstanceStepsFactoryBehaviour method shouldCreateCandidateSteps.
@Test
public void shouldCreateCandidateSteps() {
InjectableStepsFactory factory = new InstanceStepsFactory(new MostUsefulConfiguration(), new MySteps());
List<CandidateSteps> candidateSteps = factory.createCandidateSteps();
assertThat(candidateSteps.size(), equalTo(1));
assertThat(candidateSteps.get(0), instanceOf(Steps.class));
ParameterConverters converters = ((Steps) candidateSteps.get(0)).configuration().parameterConverters();
assertThat((String) converters.convert("value", String.class), equalTo("valueConverted"));
}
use of org.jbehave.core.configuration.MostUsefulConfiguration in project jbehave-core by jbehave.
the class ReportTransformBehaviour method runStories.
private void runStories(String... storyPaths) {
StoryReporterBuilder storyReporterBuilder = new StoryReporterBuilder().withDefaultFormats().withCodeLocation(CodeLocations.codeLocationFromClass(ReportTransformBehaviour.class)).withFormats(Format.XML);
Configuration configuration = new MostUsefulConfiguration().useStoryLoader(new LoadFromClasspath(this.getClass())).useStoryReporterBuilder(storyReporterBuilder).useFailureStrategy(new SilentlyAbsorbingFailure()).useStepCollector(new MarkUnmatchedStepsAsPending(new StepFinder(new ByLevenshteinDistance())));
Embedder embedder = new Embedder();
embedder.useEmbedderControls(new EmbedderControls().doGenerateViewAfterStories(false));
embedder.useConfiguration(configuration);
embedder.useCandidateSteps(new InstanceStepsFactory(configuration, new MySteps()).createCandidateSteps());
embedder.useMetaFilters(asList("-skip true"));
try {
embedder.runStoriesAsPaths(asList(storyPaths));
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.jbehave.core.configuration.MostUsefulConfiguration in project jbehave-core by jbehave.
the class GroovyAnnotationBuilderBehaviour method shouldBuildConfigurationFromAnnotations.
@Test
public void shouldBuildConfigurationFromAnnotations() {
GroovyAnnotationBuilder builder = new GroovyAnnotationBuilder(AnnotatedUsingGroovy.class);
assertThatConfigurationIs(builder.buildConfiguration(), new MostUsefulConfiguration());
}
use of org.jbehave.core.configuration.MostUsefulConfiguration in project jbehave-core by jbehave.
the class GroovyStepsFactoryBehaviour method shouldNotCreateStepsInstancesFromGroovyWhenResourceInvalid.
@Test(expected = GroovyClassInstantiationFailed.class)
public void shouldNotCreateStepsInstancesFromGroovyWhenResourceInvalid() {
GroovyStepsFactory factory = new GroovyStepsFactory(new MostUsefulConfiguration(), new GroovyContext(asList("/org/jbehave/core/steps/groovy/invalidSteps.groovy")));
factory.stepsTypes();
}
use of org.jbehave.core.configuration.MostUsefulConfiguration in project jbehave-core by jbehave.
the class GroovyStepsFactoryBehaviour method shouldCreateStepsInstancesFromGroovyWhenAnnotated.
@Test
public void shouldCreateStepsInstancesFromGroovyWhenAnnotated() {
GroovyResourceFinder resourceFinder = new GroovyResourceFinder(codeLocationFromClass(this.getClass()), "**/steps/groovy/*.groovy", "**/invalidSteps.groovy");
GroovyStepsFactory factory = new GroovyStepsFactory(new MostUsefulConfiguration(), new GroovyContext(resourceFinder));
List<Class<?>> types = factory.stepsTypes();
MatcherAssert.assertThat(types.size(), Matchers.equalTo(1));
assertThat(types.get(0).getSimpleName(), equalTo("AnnotatedSteps"));
}
Aggregations