Search in sources :

Example 46 with MostUsefulConfiguration

use of org.jbehave.core.configuration.MostUsefulConfiguration in project jbehave-core by jbehave.

the class ScanningStepsFactoryBehaviour method shouldNotFindAnyStepsFromNonAnnotatedClasses.

@Test
public void shouldNotFindAnyStepsFromNonAnnotatedClasses() {
    InjectableStepsFactory factory = new ScanningStepsFactory(new MostUsefulConfiguration(), "org.jbehave.core.steps.scan2");
    List<CandidateSteps> candidateSteps = factory.createCandidateSteps();
    assertThat(candidateSteps.size(), Matchers.equalTo(0));
}
Also used : MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) Test(org.junit.Test)

Example 47 with MostUsefulConfiguration

use of org.jbehave.core.configuration.MostUsefulConfiguration in project jbehave-core by jbehave.

the class ScanningStepsFactoryBehaviour method shouldNotFindAnyStepsFromInexistingPackage.

@Test
public void shouldNotFindAnyStepsFromInexistingPackage() {
    InjectableStepsFactory factory = new ScanningStepsFactory(new MostUsefulConfiguration(), "org.jbehave.inexisting");
    List<CandidateSteps> candidateSteps = factory.createCandidateSteps();
    assertThat(candidateSteps.size(), Matchers.equalTo(0));
}
Also used : MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) Test(org.junit.Test)

Example 48 with MostUsefulConfiguration

use of org.jbehave.core.configuration.MostUsefulConfiguration in project jbehave-core by jbehave.

the class StepCandidateBehaviour method candidateWith.

private StepCandidate candidateWith(String patternAsString, StepType stepType, Method method, Object instance, ParameterControls parameterControls) {
    Class<?> stepsType = instance.getClass();
    MostUsefulConfiguration configuration = new MostUsefulConfiguration();
    InjectableStepsFactory stepsFactory = new InstanceStepsFactory(configuration, instance);
    return new StepCandidate(patternAsString, 0, stepType, method, stepsType, stepsFactory, new StepsContext(), keywords, new RegexPrefixCapturingPatternParser(), configuration.parameterConverters(), parameterControls);
}
Also used : StepsContext(org.jbehave.core.steps.context.StepsContext) RegexPrefixCapturingPatternParser(org.jbehave.core.parsers.RegexPrefixCapturingPatternParser) MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration)

Example 49 with MostUsefulConfiguration

use of org.jbehave.core.configuration.MostUsefulConfiguration in project jbehave-core by jbehave.

the class StepCandidateBehaviour method shouldPerformStepsInDryRunMode.

@Test
public void shouldPerformStepsInDryRunMode() {
    Configuration configuration = new MostUsefulConfiguration();
    configuration.storyControls().doDryRun(true);
    NamedTypeSteps steps = new NamedTypeSteps(configuration);
    List<StepCandidate> candidates = steps.listCandidates();
    assertThat(candidates.size(), equalTo(2));
    StepCandidate step0 = candidateMatchingStep(candidates, "Given foo named $name");
    step0.createMatchedStep("Given foo named xyz", namedParameters).perform(null);
    step0.createMatchedStep("And foo named xyz", namedParameters).perform(null);
    StepCandidate step1 = candidateMatchingStep(candidates, "When foo named $name");
    step1.createMatchedStep("When foo named Bar", namedParameters).perform(null);
    step1.createMatchedStep("And foo named Bar", namedParameters).perform(null);
    assertThat(steps.givenName, nullValue());
    assertThat(steps.givenTimes, equalTo(0));
    assertThat(steps.whenName, nullValue());
    assertThat(steps.whenTimes, equalTo(0));
}
Also used : Configuration(org.jbehave.core.configuration.Configuration) MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) Test(org.junit.Test)

Example 50 with MostUsefulConfiguration

use of org.jbehave.core.configuration.MostUsefulConfiguration in project jbehave-core by jbehave.

the class GroovyAnnotationBuilderBehaviour method shouldBuildDefaultConfigurationIfAnnotationOrAnnotatedValuesNotPresent.

@Test
public void shouldBuildDefaultConfigurationIfAnnotationOrAnnotatedValuesNotPresent() {
    GroovyAnnotationBuilder builderNotAnnotated = new GroovyAnnotationBuilder(NotAnnotated.class);
    assertThatConfigurationIs(builderNotAnnotated.buildConfiguration(), new MostUsefulConfiguration());
}
Also used : MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) Test(org.junit.Test)

Aggregations

MostUsefulConfiguration (org.jbehave.core.configuration.MostUsefulConfiguration)66 Test (org.junit.Test)52 Configuration (org.jbehave.core.configuration.Configuration)14 CandidateSteps (org.jbehave.core.steps.CandidateSteps)14 StoryReporterBuilder (org.jbehave.core.reporters.StoryReporterBuilder)11 LoadFromClasspath (org.jbehave.core.io.LoadFromClasspath)8 TableTransformers (org.jbehave.core.model.TableTransformers)8 Method (java.lang.reflect.Method)7 LocalizedKeywords (org.jbehave.core.i18n.LocalizedKeywords)7 ParameterConverters (org.jbehave.core.steps.ParameterConverters)7 SimpleDateFormat (java.text.SimpleDateFormat)5 HashMap (java.util.HashMap)5 InjectableEmbedder (org.jbehave.core.InjectableEmbedder)5 UsingEmbedder (org.jbehave.core.annotations.UsingEmbedder)5 BeforeOrAfterFailed (org.jbehave.core.failures.BeforeOrAfterFailed)5 Failed (org.jbehave.core.steps.AbstractStepResult.Failed)5 ApplicationContext (org.springframework.context.ApplicationContext)5 ByteArrayOutputStream (java.io.ByteArrayOutputStream)4 OutputStream (java.io.OutputStream)4 PrintStream (java.io.PrintStream)4