当前位置: 首页>>代码示例>>Java>>正文


Java MostUsefulConfiguration类代码示例

本文整理汇总了Java中org.jbehave.core.configuration.MostUsefulConfiguration的典型用法代码示例。如果您正苦于以下问题:Java MostUsefulConfiguration类的具体用法?Java MostUsefulConfiguration怎么用?Java MostUsefulConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MostUsefulConfiguration类属于org.jbehave.core.configuration包,在下文中一共展示了MostUsefulConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUp

import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    results = new AllureResultsWriterStub();
    final AllureLifecycle lifecycle = new AllureLifecycle(results);
    StepsAspects.setLifecycle(lifecycle);
    AttachmentsAspects.setLifecycle(lifecycle);
    embedder.useEmbedderControls(new EmbedderControls()
            .doGenerateViewAfterStories(false)
            .doVerboseFailures(true)
    );
    embedder.useConfiguration(new MostUsefulConfiguration()
            .useStoryLoader(new LoadFromClasspath(this.getClass()))
            .useStoryReporterBuilder(new ReportlessStoryReporterBuilder(folder.newFolder())
                    .withReporters(new AllureJbehave(lifecycle))
            )
    );
    embedder.useCandidateSteps(new InstanceStepsFactory(embedder.configuration(), new StackSteps())
            .createCandidateSteps()
    );
}
 
开发者ID:allure-framework,项目名称:allure-java,代码行数:21,代码来源:AllureJbehaveTest.java

示例2: configuration

import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的package包/类
@Override
public Configuration configuration() {
    return new MostUsefulConfiguration()
            // 找和java相同路徑的Story
            .useStoryLoader(new LoadFromClasspath(this.getClass()))
            // 設定Story行為檔佮JUnit設定檔的檔名對應
            .useStoryPathResolver(new CasePreservingResolver())
            // 有Step沒定義到視同Error
            .usePendingStepStrategy(new FailingUponPendingStep())
            // CONSOLE和TXT報表
            .useStoryReporterBuilder(
                    new StoryReporterBuilder().withDefaultFormats().withFormats(
                            Format.CONSOLE,
                            Format.TXT
                    )
            );
}
 
开发者ID:sih4sing5hong5,项目名称:Android_with_JBehave,代码行数:18,代码来源:加字串長度試驗.java

示例3: getConfiguration

import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的package包/类
@Produces
@Singleton
@ConfigurationAlternative
@WeldConfiguration
public Configuration getConfiguration()
{
  LOG.info("ConfigurationProducer.getConfiguration()");

  Keywords keywords = new LocalizedKeywords();

  ParameterConverters converters = new ParameterConverters().addConverters(new DateConverter(new SimpleDateFormat("yyyy-MM-dd")), new StoryParameterEnumConverter());

  return new MostUsefulConfiguration().useStoryControls(new StoryControls().doDryRun(runConfig.doDryRun()).doSkipScenariosAfterFailure(false))

  .useStepPatternParser(new RegexPrefixCapturingPatternParser()).useStoryLoader(new LoadFromClasspath(this.getClass().getClassLoader()))

  .useKeywords(keywords).useStepCollector(new MarkUnmatchedStepsAsPending(keywords)).useStoryParser(new RegexStoryParser(keywords, new ExamplesTableFactory(keywords, new LoadFromClasspath(this.getClass()), converters))).useDefaultStoryReporter(new ConsoleOutput(keywords))

  .useStoryReporterBuilder(new StoryReporterBuilder().withFormats(Format.CONSOLE, Format.TXT, Format.STATS, WebDriverHtmlOutputWithImg.WEB_DRIVER_HTML_WITH_IMG).withFailureTrace(true).withReporters(new LoggingStoryReporter()).withKeywords(keywords)).useParameterConverters(converters);
}
 
开发者ID:partnet,项目名称:seauto,代码行数:21,代码来源:DefaultConfigurationProducer.java

示例4: configuration

import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的package包/类
@Override
public Configuration configuration() {
    Class<? extends Embeddable> embeddableClass = this.getClass();
    // Start from default ParameterConverters instance
    ParameterConverters parameterConverters = new ParameterConverters();
    // factory to allow parameter conversion and loading from external resources (used by StoryParser too)
    ExamplesTableFactory examplesTableFactory = new ExamplesTableFactory(new LocalizedKeywords(), new LoadFromClasspath(embeddableClass), parameterConverters);
    // add custom converters
    parameterConverters.addConverters(
            new DateConverter(new SimpleDateFormat("yyyy-MM-dd")),
            new ParameterConverters.EnumConverter()
    );
    return new MostUsefulConfiguration()
            .useStoryLoader(new LoadFromClasspath(embeddableClass))
            .useStoryParser(new RegexStoryParser(examplesTableFactory))
            .useStoryReporterBuilder(new StoryReporterBuilder()
                    .withCodeLocation(CodeLocations.codeLocationFromClass(embeddableClass))
                    .withDefaultFormats()
                    .withFormats(CONSOLE, TXT, HTML, XML))
            .useParameterConverters(parameterConverters);
}
 
开发者ID:apache,项目名称:rave,代码行数:22,代码来源:Stories.java

示例5: configuration

import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的package包/类
/**
 * <p>
 * Configuration de l'environnement d'exécution de JBehave :
 * <ul>
 * <li>CONSOLE : sortie des rapports en console pour facilitrer la phase de
 * développement dans l'IDE</li>
 * <li>HTML_TEMPLATE : génération de rapports HTML pour une meilleure
 * lisibilité au niveau de la PIC</li>
 * <li>Stratégie transmise à useStepMonitor() :
 * <ul>
 * <li>Par défaut : stratégie qui veut que les étapes du test à PENDING
 * soient ignorées, ainsi le test passe.</li>
 * <li>new FailingUponPendingStep() : stratégie qui veut que les étapes du
 * test à PENDING fassent échouer le test.</li>
 * </ul>
 * </li>
 * </ul>
 * </p>
 */
@Override
public Configuration configuration() {
    Class<? extends Embeddable> embeddableClass = this.getClass();
    URL codeLocation = codeLocationFromClass(embeddableClass);
    StoryReporterBuilder storyReporter = //
    new StoryReporterBuilder() //
            .withCodeLocation(codeLocation) //
            .withDefaultFormats() //
            .withFormats(CONSOLE, //
                    HTML_TEMPLATE) //
            .withFailureTrace(true) //
            .withFailureTraceCompression(true) //
            .withCrossReference(xref);
    return new MostUsefulConfiguration() //
            .useStoryLoader(new UTF8StoryLoader(embeddableClass)) //
            .useStoryReporterBuilder(storyReporter) //
            .usePendingStepStrategy(new FailingUponPendingStep()) //
            .useStepMonitor(xref.getStepMonitor());
}
 
开发者ID:wemanity,项目名称:Acceptance-Tests-with-JBehave,代码行数:39,代码来源:AllStoriesTest.java

示例6: configuration

import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的package包/类
@Override
public Configuration configuration() {
    Class<? extends Embeddable> embeddableClass = this.getClass();
    // Start from default ParameterConverters instance
    ParameterConverters parameterConverters = new ParameterConverters();
    // factory to allow parameter conversion and loading from external resources (used by StoryParser too)
    ExamplesTableFactory examplesTableFactory = new ExamplesTableFactory(new LocalizedKeywords(), new LoadFromClasspath(embeddableClass), parameterConverters);
    // add custom converters
    parameterConverters.addConverters(new DateConverter(new SimpleDateFormat("yyyy-MM-dd")),
            new ExamplesTableConverter(examplesTableFactory));
    return new MostUsefulConfiguration()
        .useStoryLoader(new LoadFromClasspath(embeddableClass))
        .useStoryParser(new RegexStoryParser(examplesTableFactory)) 
        .useStoryReporterBuilder(new StoryReporterBuilder()
            .withCodeLocation(CodeLocations.codeLocationFromClass(embeddableClass))
            .withDefaultFormats()
            .withFormats(CONSOLE, TXT, HTML, XML))
        .useParameterConverters(parameterConverters);
}
 
开发者ID:wemanity,项目名称:Acceptance-Tests-with-JBehave,代码行数:20,代码来源:MyStories.java

示例7: configuration

import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的package包/类
@Override
public Configuration configuration() {

  LoadFromClasspath storyLoader = new LoadFromClasspath(this.getClass());
  URL codeLocation = codeLocationFromClass(this.getClass());

  // TODO test ANSI_CONSOLE and IDE_CONSOLE format
  StoryReporterBuilder reporterBuilder = new StoryReporterBuilder()
      .withCodeLocation(codeLocation)
      .withDefaultFormats()
      .withFormats(CONSOLE, TXT, HTML, XML);

  Configuration config = new MostUsefulConfiguration()
      .useStoryLoader(storyLoader)
      .useStoryReporterBuilder(reporterBuilder);

  return config;
}
 
开发者ID:vrampal,项目名称:connectfour,代码行数:19,代码来源:BoardStory.java

示例8: configuration

import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的package包/类
@Override
public Configuration configuration() {
    Class<? extends Embeddable> embeddableClass = this.getClass();
    Properties viewResources = new Properties();
    viewResources.put("decorateNonHtml", "true");
    return new MostUsefulConfiguration()
            .useParanamer(paranamer)
            .useStoryLoader(new LoadFromClasspath(embeddableClass))
            .useStoryPathResolver(new UnderscoredCamelCaseResolver().removeFromClassName("Story"))
            .useStoryReporterBuilder(new StoryReporterBuilder()
                    .withCodeLocation(CodeLocations.codeLocationFromClass(embeddableClass))
                    .withDefaultFormats()
                    .withPathResolver(new FilePrintStreamFactory.ResolveToPackagedName())
                    .withViewResources(viewResources)
                    .withFormats(CONSOLE, TXT, HTML, XML))
            .useParameterConverters(new ParameterConverters()
                    .addConverters(new ParameterConverters.NumberConverter(), new DateConverter(new SimpleDateFormat("yyyy-MM-dd")))) // use custom date pattern
            .useStepPatternParser(new RegexPrefixCapturingPatternParser(
                    "$")) // use '%' instead of '$' to identify parameters
            .useStepMonitor(new SilentStepMonitor());
}
 
开发者ID:yujunliang,项目名称:seleniumcapsules,代码行数:22,代码来源:AllStoryRunner.java

示例9: runStories

import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的package包/类
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();
    }
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:23,代码来源:ReportTransformBehaviour.java

示例10: configuration

import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的package包/类
@Override
public Configuration configuration() {
	Class<? extends TraderEmbedder> embedderClass = this.getClass();
	return new MostUsefulConfiguration()
		.useStoryLoader(new LoadFromClasspath(embedderClass.getClassLoader()))
		.useStoryReporterBuilder(new StoryReporterBuilder()
       		.withCodeLocation(CodeLocations.codeLocationFromClass(embedderClass))
       		.withDefaultFormats()
			.withFormats(CONSOLE, TXT, HTML, XML)
			.withCrossReference(new CrossReference()))
           .useParameterConverters(new ParameterConverters()
               	.addConverters(new DateConverter(new SimpleDateFormat("yyyy-MM-dd")))) // use custom date pattern
           .useStepPatternParser(new RegexPrefixCapturingPatternParser(
						"%")) // use '%' instead of '$' to identify parameters
		.useStepMonitor(new SilentStepMonitor());								
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:17,代码来源:TraderEmbedder.java

示例11: configuration

import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的package包/类
@Override
public Configuration configuration() {
    Class<? extends Embeddable> embeddableClass = this.getClass();
    // Start from default ParameterConverters instance
    ParameterConverters parameterConverters = new ParameterConverters();
    // factory to allow parameter conversion and loading from external resources (used by StoryParser too)
    ExamplesTableFactory examplesTableFactory = new ExamplesTableFactory(new LocalizedKeywords(), new LoadFromClasspath(embeddableClass), parameterConverters);
    // add custom converters
    parameterConverters.addConverters(new DateConverter(new SimpleDateFormat("yyyy-MM-dd")),
            new ExamplesTableConverter(examplesTableFactory));
    return new MostUsefulConfiguration()
    .useStoryLoader(new LoadFromClasspath(embeddableClass))
    .useStoryParser(new RegexStoryParser(examplesTableFactory))
    .useStoryReporterBuilder(new StoryReporterBuilder()
    .withCodeLocation(CodeLocations.codeLocationFromClass(embeddableClass))
    .withDefaultFormats()
    .withFormats(CONSOLE, TXT, HTML, XML))
    .useParameterConverters(parameterConverters);
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:20,代码来源:MyStories.java

示例12: PlayersCanHazTurns

import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的package包/类
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)
               .withDefaultFormats()
               .withFormats(CONSOLE, TXT)
               .withFailureTrace(true)
               .withKeywords(keywords));
   useConfiguration(configuration);
   WindowControl windowControl = new WindowControl();        
   addSteps(new InstanceStepsFactory(configuration, new LolCatzSteps(windowControl), new BeforeAndAfterSteps(windowControl)).createCandidateSteps());
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:20,代码来源:PlayersCanHazTurns.java

示例13: assertThatStepsCanBeCreated

import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的package包/类
@Test
public void assertThatStepsCanBeCreated() throws NoSuchFieldException, IllegalAccessException {
    // Given
    Injector parent = Guice.createInjector(new AbstractModule() {
        @Override
        protected void configure() {              
            bind(FooSteps.class).in(Scopes.SINGLETON);
        }
      });

    AbstractStepsFactory factory = new GuiceStepsFactory(new MostUsefulConfiguration(), parent);
    // When
    List<CandidateSteps> steps = factory.createCandidateSteps();
    // Then 
    assertFooStepsFound(steps);
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:17,代码来源:GuiceStepsFactoryBehaviour.java

示例14: assertThatStepsWithStepsWithDependencyCanBeCreated

import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的package包/类
@Test
public void assertThatStepsWithStepsWithDependencyCanBeCreated() throws NoSuchFieldException, IllegalAccessException {
    Injector parent = Guice.createInjector(new AbstractModule() {
        @Override
        protected void configure() {
          bind(Integer.class).toInstance(42);
          bind(FooStepsWithDependency.class).in(Scopes.SINGLETON);
        }
      });

    // When
    AbstractStepsFactory factory = new GuiceStepsFactory(new MostUsefulConfiguration(), parent);
    List<CandidateSteps> steps = factory.createCandidateSteps();
    // Then
    assertFooStepsFound(steps);
    assertEquals(42, (int) ((FooStepsWithDependency) stepsInstance(steps.get(0))).integer);
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:18,代码来源:GuiceStepsFactoryBehaviour.java

示例15: shouldAllowOverrideOfDefaultConfiguration

import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的package包/类
@Test
public void shouldAllowOverrideOfDefaultConfiguration() throws Throwable {
    // Given
    Embedder embedder = mock(Embedder.class);
    Configuration configuration = mock(Configuration.class);
    StoryPathResolver pathResolver = mock(StoryPathResolver.class);
    when(embedder.configuration()).thenReturn(configuration);
    when(configuration.storyPathResolver()).thenReturn(pathResolver);
    Class<MyStory> storyClass = MyStory.class;
    String storyPath = "/path/to/story";
    when(pathResolver.resolve(storyClass)).thenReturn(storyPath);
    CandidateSteps steps = mock(CandidateSteps.class);
    
    // When
    MyStory story = new MyStory(new MostUsefulConfiguration(), steps);
    assertThat(story.configuration(), is(not(sameInstance(configuration))));
    story.useConfiguration(configuration);
    assertThat(story.configuration(), is(sameInstance(configuration)));
    story.useEmbedder(embedder);
    story.run();

    // Then
    verify(embedder).useConfiguration(configuration);
    verify(embedder).useCandidateSteps(Mockito.eq(Arrays.asList(steps)));
    verify(embedder).runStoriesAsPaths(asList(storyPath));
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:27,代码来源:ConfigurableEmbedderBehaviour.java


注:本文中的org.jbehave.core.configuration.MostUsefulConfiguration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。