Package org.jbehave.core.configuration

Examples of org.jbehave.core.configuration.MostUsefulConfiguration


  }

  @Test
  public void shouldScanStepsFromPackagesAndIgnoreClassesNotAnnotated() {
    InjectableStepsFactory factory = new ScanningStepsFactory(
        new MostUsefulConfiguration(), "org.jbehave.core.steps.scan",
        "org.jbehave.core.steps.scan2");
    List<CandidateSteps> candidateSteps = factory.createCandidateSteps();
    assertThat(candidateSteps.size(), Matchers.equalTo(3));
  }
View Full Code Here


  }

  @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));
  }
View Full Code Here

  }

  @Test
  public void shouldScanStepsFromPackagesAndFilterMatchingNames() {
    InjectableStepsFactory factory = new ScanningStepsFactory(
        new MostUsefulConfiguration(), "org.jbehave.core.steps.scan")
        .matchingNames(".*GivenWhen.*").notMatchingNames(".*GivenWhenThen");
    List<CandidateSteps> candidateSteps = factory.createCandidateSteps();
    assertThat(candidateSteps.size(), Matchers.equalTo(1));
  }
View Full Code Here

  }

  @Test
  public void shouldNotFindAnyStepsFromInexistingPackage() {
    InjectableStepsFactory factory = new ScanningStepsFactory(
        new MostUsefulConfiguration(), "org.jbehave.inexisting");
    List<CandidateSteps> candidateSteps = factory.createCandidateSteps();
    assertThat(candidateSteps.size(), Matchers.equalTo(0));
  }
View Full Code Here

    private StepFinder finder = new StepFinder();
   
    @Test
    public void shouldFindStepdocs() throws Exception {
        MySteps mySteps = new MySteps();
        List<Stepdoc> stepdocs = finder.stepdocs(new InstanceStepsFactory(new MostUsefulConfiguration(), mySteps).createCandidateSteps());
        Collections.sort(stepdocs);
        assertThat(stepdocs.size(), equalTo(3));
        assertThatStepdocIs(stepdocs.get(0), "givenFoo", "givenFoo(java.lang.String)", "foo named $name", "Given", GIVEN, mySteps);
        assertThatStepdocIs(stepdocs.get(1), "whenFoo", "whenFoo(java.lang.String)", "foo named $name", "When", WHEN, mySteps);
        assertThatStepdocIs(stepdocs.get(2), "thenFoo", "thenFoo(java.lang.String)", "foo named $name", "Then", THEN, mySteps);       
View Full Code Here

    }

    @Override
    public Configuration configuration() {
        Class<? extends Embeddable> embeddableClass = this.getClass();
        return new MostUsefulConfiguration().useStoryLoader(new LoadFromClasspath(embeddableClass))
                .useStoryReporterBuilder(
                        new StoryReporterBuilder()
                                .withCodeLocation(CodeLocations.codeLocationFromClass(embeddableClass))
                                .withDefaultFormats().withFormats(CONSOLE, HTML).withFailureTrace(true)
                                .withFailureTraceCompression(true));
View Full Code Here

    public PlayersCanHazTurns() {       
        ClassLoader classLoader = this.getClass().getClassLoader();
        URL codeLocation = CodeLocations.codeLocationFromClass(this.getClass());
        Keywords keywords = new LocalizedKeywords(new Locale("lc"),
                "i18n/keywords", classLoader);
        Configuration configuration = new MostUsefulConfiguration()
            .useKeywords(keywords)
            .useStoryParser(new RegexStoryParser(keywords))
            .useStoryPathResolver(new UnderscoredCamelCaseResolver(""))
            .useStoryReporterBuilder(new StoryReporterBuilder()
                    .withCodeLocation(codeLocation)
View Full Code Here

    /**
     * Creates Steps with default configuration for a class extending this
     * instance and containing the candidate step methods
     */
    public Steps() {
        this(new MostUsefulConfiguration());
    }
View Full Code Here

    }

    @Test
    public void shouldListCandidateStepsFromAnnotatedMethodsInPojo() {
        PojoSteps steps = new PojoSteps();
        Configuration configuration = new MostUsefulConfiguration();
    List<StepCandidate> candidates = new InstanceStepsFactory(configuration, steps).createCandidateSteps().get(0).listCandidates();
        assertThat(candidates.size(), equalTo(6));

        findCandidate(candidates, "GIVEN a given").createMatchedStep("Given a given", tableRow).perform(null);
        findCandidate(candidates, "GIVEN a given alias").createMatchedStep("Given a given alias", tableRow).perform(null);
View Full Code Here

        assertThat(step.toString(), Matchers.containsString(stepMonitor.getClass().getName()));
    }

    @Test
    public void shouldAllowLocalizationOfSteps(){
        Configuration configuration = new MostUsefulConfiguration();
        configuration.useKeywords(new LocalizedKeywords(new Locale("it")));
      LocalizedSteps steps = new LocalizedSteps(configuration);
        List<StepCandidate> candidates = steps.listCandidates();
        assertThat(candidates.size(), equalTo(3));

        findCandidate(candidates, "GIVEN un dato che").createMatchedStep("Dato che un dato che", tableRow).perform(null);
View Full Code Here

TOP

Related Classes of org.jbehave.core.configuration.MostUsefulConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.