• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Story类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: beforeScenario

import org.jbehave.core.model.Story; //导入依赖的package包/类
@Override
public void beforeScenario(final String title) {
    final Story story = stories.get();
    final String uuid = scenarios.get();
    final String fullName = String.format("%s: %s", story.getName(), title);
    final TestResult result = new TestResult()
            .withUuid(uuid)
            .withName(title)
            .withFullName(fullName)
            .withStage(Stage.SCHEDULED)
            .withLabels(createStoryLabel(story.getName()), createHostLabel(), createThreadLabel())
            .withDescription(story.getDescription().asString())
            .withHistoryId(md5(fullName));
    getLifecycle().scheduleTestCase(result);
    getLifecycle().startTestCase(result.getUuid());
}
 
开发者ID:allure-framework,项目名称:allure-java,代码行数:17,代码来源:AllureJbehave.java


示例2: beforeStory

import org.jbehave.core.model.Story; //导入依赖的package包/类
@Override
public void beforeStory(Story story, boolean givenStory)
{
  // name includes full path so try to extract just the last component (i.e.
  // the story filename)
  // and put that into the MDC
  String name = story.getName();
  String shortName = name;

  int idx = name.lastIndexOf('/') + 1;
  if (idx > 0) {
    shortName = name.substring(idx);
  }

  MDC.put("story", shortName);
  LOG.info("LoggingStoryReporter.beforeStory() - (path: {})", story.getPath());
}
 
开发者ID:partnet,项目名称:seauto,代码行数:18,代码来源:LoggingStoryReporter.java


示例3: shouldParseStoryWithNarrativeUsingGherkin

import org.jbehave.core.model.Story; //导入依赖的package包/类
@Test
public void shouldParseStoryWithNarrativeUsingGherkin() throws IOException{
	String storyAsText = "Feature: Hello Car\n"
			    + "Narrative:\n"
			    + "In order to feel safer\n"
			    + "As a car driver\n"
			    + "I want to drive cars on 4 wheels\n"
				+ "Scenario: Car can drive\n"
				+ "Given I have a car with 4 wheels\n"
				+ "Then I can drive it.\n";
	Story story = storyParser.parseStory(storyAsText);
	assertThat(story.getDescription().asString(), equalTo("Hello Car"));		
	Narrative narrative = story.getNarrative();
	assertThat(narrative.inOrderTo(), equalTo("feel safer"));
	assertThat(narrative.asA(), equalTo("car driver"));
	assertThat(narrative.iWantTo(), equalTo("drive cars on 4 wheels"));
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:18,代码来源:GherkinStoryParserBehaviour.java


示例4: shouldFailWithFailingUpongPendingStepsStrategy

import org.jbehave.core.model.Story; //导入依赖的package包/类
@Test(expected = PendingStepFound.class)
public void shouldFailWithFailingUpongPendingStepsStrategy() throws Throwable {
    // Given
    StoryReporter reporter = mock(ConcurrentStoryReporter.class);
    Step pendingStep = mock(Step.class);
    StepResult pendingResult = pending("My step isn't defined!");
    when(pendingStep.perform(null)).thenReturn(pendingResult);
    PendingStepStrategy strategy = new FailingUponPendingStep();
    StepCollector collector = mock(StepCollector.class);
    CandidateSteps mySteps = new Steps();
    when(collector.collectScenarioSteps(eq(asList(mySteps)), (Scenario) anyObject(), eq(parameters))).thenReturn(
            asList(pendingStep));
    Story story = new Story(asList(new Scenario()));
    givenStoryWithNoBeforeOrAfterSteps(story, false, collector, mySteps);

    // When
    StoryRunner runner = new StoryRunner();
    runner.run(configurationWithPendingStrategy(collector, reporter,
            strategy), asList(mySteps), story);

    // Then ... fail as expected
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:23,代码来源:StoryRunnerBehaviour.java


示例5: shouldRunBeforeAndAfterStorySteps

import org.jbehave.core.model.Story; //导入依赖的package包/类
@Test
public void shouldRunBeforeAndAfterStorySteps() throws Throwable {
    // Given
    StoryReporter reporter = mock(ConcurrentStoryReporter.class);
    Step beforeStep = mockSuccessfulStep("beforeStep");
    Step afterStep = mockSuccessfulStep("secondStep");
    StepCollector collector = mock(StepCollector.class);
    FailureStrategy strategy = mock(FailureStrategy.class);
    CandidateSteps mySteps = new Steps();
    Story story = new Story();
    boolean givenStory = false;
    when(collector.collectBeforeOrAfterStorySteps(asList(mySteps), story, Stage.BEFORE, givenStory)).thenReturn(asList(beforeStep));
    when(collector.collectBeforeOrAfterStorySteps(asList(mySteps), story, Stage.AFTER, givenStory)).thenReturn(asList(afterStep));

    // When
    StoryRunner runner = new StoryRunner();
    runner.run(configurationWith(reporter, collector, strategy),asList(mySteps), story);

    // Then
    verify(beforeStep).perform(null);
    verify(afterStep).perform(null);
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:23,代码来源:StoryRunnerBehaviour.java


示例6: map

import org.jbehave.core.model.Story; //导入依赖的package包/类
/**
 * Maps a story if it is allowed by the meta filter
 * 
 * @param story
 *            the Story
 * @param metaFilter
 *            the meta filter
 */
public void map(Story story, MetaFilter metaFilter) {
    if (metaFilter.allow(story.getMeta())) {
        boolean allowed = false;
        for (Scenario scenario : story.getScenarios()) {
            // scenario also inherits meta from story
            Meta inherited = scenario.getMeta().inheritFrom(story.getMeta());
            if (metaFilter.allow(inherited)) {
                allowed = true;
                break;
            }
        }
        if (allowed) {
            add(metaFilter.asString(), story);
        }
    }
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:25,代码来源:StoryMapper.java


示例7: shouldHandlePendingStepsAccordingToStrategy

import org.jbehave.core.model.Story; //导入依赖的package包/类
@Test
public void shouldHandlePendingStepsAccordingToStrategy() throws Throwable {
    // Given
    StoryReporter reporter = mock(ConcurrentStoryReporter.class);
    Step pendingStep = mock(Step.class);
    StepResult pendingResult = pending("My step isn't defined!");
    when(pendingStep.perform(null)).thenReturn(pendingResult);
    PendingStepStrategy strategy = mock(PendingStepStrategy.class);
    StepCollector collector = mock(StepCollector.class);
    CandidateSteps mySteps = new Steps();
    when(collector.collectScenarioSteps(eq(asList(mySteps)), (Scenario) anyObject(), eq(parameters))).thenReturn(
            asList(pendingStep));
    Story story = new Story(asList(new Scenario()));
    givenStoryWithNoBeforeOrAfterSteps(story, false, collector, mySteps);

    // When
    StoryRunner runner = new StoryRunner();
    runner.run(configurationWithPendingStrategy(collector, reporter,
            strategy), asList(mySteps), story);

    // Then
    verify(strategy).handleFailure(pendingResult.getFailure());
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:24,代码来源:StoryRunnerBehaviour.java


示例8: shouldParseStoryWithMeta

import org.jbehave.core.model.Story; //导入依赖的package包/类
@Test
public void shouldParseStoryWithMeta() {
    String wholeStory = "Meta: @skip @theme parsing" + NL + 
    		"GivenStories: path1,path2 " + NL +
            "Scenario: A scenario" + NL +
            "Meta: @author Mauro" + NL +
            "Given a step " + NL +
            "Scenario: Another scenario" + NL +
            "Meta: @author Paul" + NL +
            "Given another step ";
    Story story = parser.parseStory(
            wholeStory, storyPath);
    assertThat(story.getPath(), equalTo(storyPath));
    Meta storyMeta = story.getMeta();
    assertThat(storyMeta.getProperty("theme"), equalTo("parsing"));
    assertThat(storyMeta.getProperty("skip"), equalTo(""));
    assertThat(storyMeta.getProperty("unknown"), equalTo(""));        
    assertThat(story.getGivenStories().getPaths(), equalTo(asList("path1", "path2")));
    List<Scenario> scenarios = story.getScenarios();
    assertThat(scenarios.get(0).getTitle(), equalTo("A scenario"));
    assertThat(scenarios.get(0).getMeta().getProperty("author"), equalTo("Mauro"));
    assertThat(scenarios.get(1).getTitle(), equalTo("Another scenario"));
    assertThat(scenarios.get(1).getMeta().getProperty("author"), equalTo("Paul"));
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:25,代码来源:RegexStoryParserBehaviour.java


示例9: shouldAllowSpacesInMetaProperties

import org.jbehave.core.model.Story; //导入依赖的package包/类
@Test
public void shouldAllowSpacesInMetaProperties() {
    String wholeStory = "Meta: @ theme parsing @ skip" + NL +
            "Scenario: " + NL +
            "Meta: @authors Mauro Paul" + NL +
            "Given a scenario " + NL +
            "When I parse it" + NL +
            "Then I should get steps";
    Story story = parser.parseStory(
            wholeStory, storyPath);
    assertThat(story.getPath(), equalTo(storyPath));
    Meta storyMeta = story.getMeta();
    assertThat(storyMeta.getProperty("theme"), equalTo("parsing"));
    assertThat(storyMeta.getProperty("skip"), equalTo(""));
    assertThat(story.getScenarios().get(0).getMeta().getProperty("authors"), equalTo("Mauro Paul"));
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:17,代码来源:RegexStoryParserBehaviour.java


示例10: runStories

import org.jbehave.core.model.Story; //导入依赖的package包/类
public void runStories(List<String> storyPaths, MetaFilter filter, BatchFailures failures) {
    // configure cross reference with meta filter
    if ( configuration.storyReporterBuilder().hasCrossReference() ){
        configuration.storyReporterBuilder().crossReference().withMetaFilter(filter.asString());
    }
    
    // run before stories
    State beforeStories = runBeforeOrAfterStories(failures, Stage.BEFORE);

    // run stories as paths
    runningStoriesAsPaths(storyPaths, filter, beforeStories);
    waitUntilAllDoneOrFailed(failures);
    List<Story> notAllowed = notAllowedBy(filter);
    if (!notAllowed.isEmpty()) {
        embedderMonitor.storiesNotAllowed(notAllowed, filter, embedderControls.verboseFiltering());
    }

    // run after stories
   runBeforeOrAfterStories(failures, Stage.AFTER);
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:21,代码来源:StoryManager.java


示例11: mapStoriesAsPaths

import org.jbehave.core.model.Story; //导入依赖的package包/类
public void mapStoriesAsPaths(List<String> storyPaths) {
    EmbedderControls embedderControls = embedderControls();
    embedderMonitor.usingControls(embedderControls);

    if (embedderControls.skip()) {
        embedderMonitor.storiesSkipped(storyPaths);
        return;
    }

    processSystemProperties();

    StoryManager storyManager = storyManager();
    for (String storyPath : storyPaths) {
        Story story = storyManager.storyOfPath(storyPath);
        embedderMonitor.mappingStory(storyPath, metaFilters);
        storyMapper.map(story, new MetaFilter(""));
        for (String filter : metaFilters) {
            storyMapper.map(story, new MetaFilter(filter));
        }
    }

    generateMapsView(storyMapper.getStoryMaps());

}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:25,代码来源:Embedder.java


示例12: shouldNotPassSilentlyOutputNotAllowedByMetaFilter

import org.jbehave.core.model.Story; //导入依赖的package包/类
@Test
public void shouldNotPassSilentlyOutputNotAllowedByMetaFilter() {
    // Given
    StoryReporter delegate = mock(StoryReporter.class);
    SilentSuccessFilter filter = new SilentSuccessFilter(delegate);
    Story story = new Story();
    Scenario scenario = new Scenario();

    String metaFilter = "";
    // When
    filter.storyNotAllowed(story, metaFilter);
    filter.scenarioNotAllowed(scenario, metaFilter);

    // Then
    InOrder inOrder = inOrder(delegate);

    inOrder.verify(delegate).storyNotAllowed(story, metaFilter);
    inOrder.verify(delegate).scenarioNotAllowed(scenario, metaFilter);

}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:21,代码来源:SilentSuccessFilterBehaviour.java


示例13: stepMatchesPattern

import org.jbehave.core.model.Story; //导入依赖的package包/类
public void stepMatchesPattern(String step, boolean matches, StepPattern pattern, Method method,
        Object stepsInstance) {
    Story story = currentStory.get();
    if (story == null) {
        throw new NullPointerException("story not setup for CrossReference");
    }

    if (matches) {
        String key = pattern.type() + pattern.annotated();
        StepMatch stepMatch = stepMatches.get(key);
        if (stepMatch == null) {
            stepMatch = new StepMatch(pattern.type(), pattern.annotated(), pattern.resolved());
            stepMatches.put(key, stepMatch);
        }
        // find canonical ref for same stepMatch
        stepMatch.usages.add(new StepUsage(story.getPath(), currentScenarioTitle.get(), step));
    }
    super.stepMatchesPattern(step, matches, pattern, method, stepsInstance);
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:20,代码来源:CrossReference.java


示例14: shouldIgnoreCommentsInMetaProperties

import org.jbehave.core.model.Story; //导入依赖的package包/类
@Test
public void shouldIgnoreCommentsInMetaProperties() {
    String wholeStory = "Meta: !-- this is the theme @theme parsing !-- skip me @skip" + NL +
            "Scenario: " + NL +
            "Meta: !-- these are the authors @authors Mauro Paul" + NL +
            "Given a scenario " + NL +
            "When I parse it" + NL +
            "Then I should get steps";
    Story story = parser.parseStory(
            wholeStory, storyPath);
    assertThat(story.getPath(), equalTo(storyPath));
    Meta storyMeta = story.getMeta();
    assertThat(storyMeta.getProperty("theme"), equalTo("parsing"));
    assertThat(storyMeta.getProperty("skip"), equalTo(""));
    assertThat(story.getScenarios().get(0).getMeta().getProperty("authors"), equalTo("Mauro Paul"));
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:17,代码来源:RegexStoryParserBehaviour.java


示例15: shouldParseStoryWithDescriptionAndNarrative

import org.jbehave.core.model.Story; //导入依赖的package包/类
@Test
public void shouldParseStoryWithDescriptionAndNarrative() {
    String wholeStory = "Story: This is free-text description"+ NL +
            "Narrative: This bit of text is ignored" + NL +
            "In order to renovate my house" + NL +
            "As a customer" + NL +
            "I want to get a loan" + NL +
            "Scenario:  A first scenario";
    Story story = parser.parseStory(
            wholeStory, storyPath);
    Description description = story.getDescription();
    assertThat(description.asString(), equalTo("Story: This is free-text description"));
    Narrative narrative = story.getNarrative();
    assertThat(narrative.isEmpty(), not(true));
    assertThat(narrative.inOrderTo().toString(), equalTo("renovate my house"));
    assertThat(narrative.asA().toString(), equalTo("customer"));
    assertThat(narrative.iWantTo().toString(), equalTo("get a loan"));
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:19,代码来源:RegexStoryParserBehaviour.java


示例16: shouldParseStoryWithoutAPath

import org.jbehave.core.model.Story; //导入依赖的package包/类
@Test
public void shouldParseStoryWithoutAPath() {
    String wholeStory = "Given a step" + NL +
            "When I run it" + NL +
            "Then I should an output";

    Story story = parser.parseStory(wholeStory);

    assertThat(story.getPath(), equalTo(""));
    Scenario scenario = story.getScenarios().get(0);
    assertThat(scenario.getSteps(), equalTo(asList(
            "Given a step",
            "When I run it",
            "Then I should an output"
    )));
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:17,代码来源:RegexStoryParserBehaviour.java


示例17: shouldInvokeBeforeOrAfterStoryWithParameter

import org.jbehave.core.model.Story; //导入依赖的package包/类
@Test
public void shouldInvokeBeforeOrAfterStoryWithParameter() throws Exception {
    BeforeOrAfterStoryWithParameter steps = new BeforeOrAfterStoryWithParameter();
    Story story = mock(Story.class);
    when(story.getMeta()).thenReturn(beforeAndAfterMeta());

    MarkUnmatchedStepsAsPending collector = new MarkUnmatchedStepsAsPending();

    List<Step> beforeSteps = collector.collectBeforeOrAfterStorySteps(asList((CandidateSteps) steps), story,
            Stage.BEFORE, false);
    beforeSteps.get(0).perform(null);
    assertThat(steps.value, is("before"));

    List<Step> afterSteps = collector.collectBeforeOrAfterStorySteps(asList((CandidateSteps) steps), story,
            Stage.AFTER, false);
    afterSteps.get(0).perform(null);
    assertThat(steps.value, is("after"));
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:19,代码来源:MarkUnmatchedStepsAsPendingBehaviour.java


示例18: shouldNotRunStoriesNotAllowedByFilterOnStoryElement

import org.jbehave.core.model.Story; //导入依赖的package包/类
@Test
public void shouldNotRunStoriesNotAllowedByFilterOnStoryElement() throws Throwable {
    // Given
    StoryReporter reporter = mock(ConcurrentStoryReporter.class);
    StepCollector collector = mock(StepCollector.class);
    FailureStrategy strategy = mock(FailureStrategy.class);
    CandidateSteps mySteps = new Steps();
    when(collector.collectScenarioSteps(eq(asList(mySteps)), (Scenario) anyObject(), eq(parameters))).thenReturn(
            Arrays.<Step>asList());
    Story story = new Story("excluded_path", Description.EMPTY, Meta.EMPTY, Narrative.EMPTY, asList(new Scenario()));
    boolean givenStory = false;
    givenStoryWithNoBeforeOrAfterSteps(story, givenStory, collector, mySteps);
    String filterAsString = "-story_path excluded_path";
    MetaFilter filter = new MetaFilter(filterAsString);
    
    // When
    StoryRunner runner = new StoryRunner();
    Configuration configuration = configurationWith(reporter, collector, strategy);
    configuration.storyControls().useStoryMetaPrefix("story_");
    runner.run(configuration, asList(mySteps), story, filter);

    // Then
    verify(reporter).beforeStory(story, givenStory);
    verify(reporter).storyNotAllowed(story, filterAsString);
    verify(reporter).afterStory(givenStory);
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:27,代码来源:StoryRunnerBehaviour.java


示例19: beforeStory

import org.jbehave.core.model.Story; //导入依赖的package包/类
@Override
public void beforeStory(final Story story, final boolean givenStory) {
    String path = story.getPath();
    if (!path.equals(BEFORE_STORIES_PATH) && !path.equals(AFTER_STORIES_PATH)) {
        String message = createFileContentsMessage(path);
        jBehaveTestCase.logComment("Using story file: " + path, message);
    }
}
 
开发者ID:epam,项目名称:Gepard,代码行数:9,代码来源:JBehaveStoryReporter.java


示例20: testBeforeStoryShouldNotLogAfterStories

import org.jbehave.core.model.Story; //导入依赖的package包/类
@Test
public void testBeforeStoryShouldNotLogAfterStories() {
    //GIVEN
    Story story = new Story(AFTER_STORIES_PATH);
    //WHEN
    underTest.beforeStory(story, false);
    //THEN
    verify(jBehaveTestCase, never()).logComment(Mockito.anyString());
}
 
开发者ID:epam,项目名称:Gepard,代码行数:10,代码来源:JBehaveStoryReporterTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SeriesMarker类代码示例发布时间:2022-05-23
下一篇:
Java BlockEntityBeacon类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap