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

Java Steps类代码示例

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

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



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

示例1: shouldRunStepsBeforeAndAfterStories

import org.jbehave.core.steps.Steps; //导入依赖的package包/类
@Test
public void shouldRunStepsBeforeAndAfterStories() throws Throwable {
    // Given
    Step beforeStep = mock(Step.class, "beforeStep");
    StepResult beforeResult = mock(StepResult.class);
    when(beforeStep.perform(null)).thenReturn(beforeResult);
    Step afterStep = mock(Step.class, "afterStep");
    StepResult afterResult = mock(StepResult.class);
    when(afterStep.perform(null)).thenReturn(afterResult);
    StepCollector collector = mock(StepCollector.class);
    CandidateSteps mySteps = new Steps();
    StoryReporter reporter = mock(StoryReporter.class);
    FailureStrategy failureStrategy = mock(FailureStrategy.class);

    // When
    StoryRunner runner = new StoryRunner();
    when(collector.collectBeforeOrAfterStoriesSteps(asList(mySteps), Stage.BEFORE)).thenReturn(asList(beforeStep));
    runner.runBeforeOrAfterStories(configurationWith(reporter, collector, failureStrategy), asList(mySteps), Stage.BEFORE);
    when(collector.collectBeforeOrAfterStoriesSteps(asList(mySteps), Stage.AFTER)).thenReturn(asList(afterStep));
    runner.runBeforeOrAfterStories(configurationWith(reporter, collector, failureStrategy), asList(mySteps), Stage.AFTER);

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


示例2: shouldRunBeforeAndAfterStorySteps

import org.jbehave.core.steps.Steps; //导入依赖的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


示例3: shouldHandlePendingStepsAccordingToStrategy

import org.jbehave.core.steps.Steps; //导入依赖的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


示例4: shouldFailWithFailingUpongPendingStepsStrategy

import org.jbehave.core.steps.Steps; //导入依赖的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: shouldNotRunStoriesNotAllowedByFilter

import org.jbehave.core.steps.Steps; //导入依赖的package包/类
@Test
public void shouldNotRunStoriesNotAllowedByFilter() 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());
    Meta meta = new Meta(asList("some property"));
    Story story = new Story("", Description.EMPTY, meta, Narrative.EMPTY, asList(new Scenario()));
    boolean givenStory = false;
    givenStoryWithNoBeforeOrAfterSteps(story, givenStory, collector, mySteps);
    String filterAsString = "-some property";
    MetaFilter filter = new MetaFilter(filterAsString);
    
    // When
    StoryRunner runner = new StoryRunner();
    runner.run(configurationWith(reporter, collector, strategy), asList(mySteps), story, filter);

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


示例6: shouldNotRunStoriesNotAllowedByFilterOnStoryElement

import org.jbehave.core.steps.Steps; //导入依赖的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


示例7: shouldNotRunScenariosNotAllowedByFilter

import org.jbehave.core.steps.Steps; //导入依赖的package包/类
@Test
public void shouldNotRunScenariosNotAllowedByFilter() 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());
    Meta meta = new Meta(asList("some property"));
    Story story = new Story("", Description.EMPTY, Meta.EMPTY, Narrative.EMPTY, asList(new Scenario("", meta, GivenStories.EMPTY, ExamplesTable.EMPTY, asList(""))));
    boolean givenStory = false;
    givenStoryWithNoBeforeOrAfterSteps(story, givenStory, collector, mySteps);
    String filterAsString = "-some property";
    MetaFilter filter = new MetaFilter(filterAsString);

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

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


示例8: stepsFactory

import org.jbehave.core.steps.Steps; //导入依赖的package包/类
@Override
public InjectableStepsFactory stepsFactory() {
	ArrayList<Steps> stepFileList = new ArrayList<Steps>();
	stepFileList.add(new LoadByteSteps());
	
    return new InstanceStepsFactory(configuration(), stepFileList);       
}
 
开发者ID:davidholiday,项目名称:java-compression-experiment,代码行数:8,代码来源:JBehaveRunner_Test.java


示例9: stepsFactory

import org.jbehave.core.steps.Steps; //导入依赖的package包/类
@Override
public InjectableStepsFactory stepsFactory() {
	ArrayList<Steps> stepFileList = new ArrayList<Steps>();
	stepFileList.add(new JBehaveTest());

	return new InstanceStepsFactory(configuration(), stepFileList);
}
 
开发者ID:davidholiday,项目名称:ALTk,代码行数:8,代码来源:JBehaveRunner_Test.java


示例10: shouldReportFailuresInStepsBeforeAndAfterStories

import org.jbehave.core.steps.Steps; //导入依赖的package包/类
@Test
public void shouldReportFailuresInStepsBeforeAndAfterStories() throws Throwable {
    // Given
    Step beforeStep = mock(Step.class, "beforeStep");
    StepResult beforeResult = mock(StepResult.class, "beforeStep");
    when(beforeStep.perform(null)).thenReturn(beforeResult);
    UUIDExceptionWrapper failure = new UUIDExceptionWrapper("failed");
    when(beforeResult.getFailure()).thenReturn(failure);
    Step afterStep = mock(Step.class, "afterStep");
    StepResult afterResult = mock(StepResult.class);
    when(afterStep.doNotPerform(failure)).thenReturn(afterResult);
    StepCollector collector = mock(StepCollector.class);
    CandidateSteps mySteps = new Steps();
    StoryReporter reporter = mock(StoryReporter.class);
    FailureStrategy failureStrategy = mock(FailureStrategy.class);

    // When
    StoryRunner runner = new StoryRunner();
    when(collector.collectBeforeOrAfterStoriesSteps(asList(mySteps), Stage.BEFORE)).thenReturn(asList(beforeStep));
    runner.runBeforeOrAfterStories(configurationWith(reporter, collector, failureStrategy), asList(mySteps), Stage.BEFORE);
    when(collector.collectBeforeOrAfterStoriesSteps(asList(mySteps), Stage.AFTER)).thenReturn(asList(afterStep));
    runner.runBeforeOrAfterStories(configurationWith(reporter, collector, failureStrategy), asList(mySteps), Stage.AFTER);

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


示例11: shouldNotPerformStepsAfterFailedOrPendingSteps

import org.jbehave.core.steps.Steps; //导入依赖的package包/类
@Test
public void shouldNotPerformStepsAfterFailedOrPendingSteps() throws Throwable {
    // Given
    StoryReporter reporter = mock(ConcurrentStoryReporter.class);
    Step firstStepNormal = mockSuccessfulStep("Given I succeed");
    Step secondStepPending = mock(Step.class, "secondStepPending");
    Step thirdStepNormal = mock(Step.class, "thirdStepNormal");
    Step fourthStepAlsoPending = mock(Step.class, "fourthStepAlsoPending");
    StepCollector collector = mock(StepCollector.class);
    CandidateSteps mySteps = new Steps();
    Scenario scenario = new Scenario();
    when(collector.collectScenarioSteps(eq(asList(mySteps)), eq(scenario), eq(parameters))).thenReturn(
            asList(firstStepNormal, secondStepPending, thirdStepNormal, fourthStepAlsoPending));
    when(secondStepPending.perform(null)).thenReturn(pending("When I am pending"));
    when(thirdStepNormal.doNotPerform(Matchers.<UUIDExceptionWrapper>any())).thenReturn(notPerformed("Then I should not be performed"));
    when(fourthStepAlsoPending.doNotPerform(Matchers.<UUIDExceptionWrapper>any())).thenReturn(
    		notPerformed("Then I should not be performed either"));
    Story story = new Story(asList(scenario));
    givenStoryWithNoBeforeOrAfterSteps(story, false, collector, mySteps);

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

    // Then
    verify(firstStepNormal).perform(null);
    verify(secondStepPending).perform(null);
    verify(thirdStepNormal).doNotPerform(Matchers.<UUIDExceptionWrapper>any());
    verify(fourthStepAlsoPending).doNotPerform(Matchers.<UUIDExceptionWrapper>any());

    verify(reporter).successful("Given I succeed");
    verify(reporter).pending("When I am pending");
    verify(reporter).notPerformed("Then I should not be performed");
    verify(reporter).notPerformed("Then I should not be performed either");
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:36,代码来源:StoryRunnerBehaviour.java


示例12: shouldReportAnyFailuresAndHandleThemAfterStory

import org.jbehave.core.steps.Steps; //导入依赖的package包/类
@Test
public void shouldReportAnyFailuresAndHandleThemAfterStory() throws Throwable {
    // Given
    StoryReporter reporter = mock(ConcurrentStoryReporter.class);
    Step firstStepExceptional = mock(Step.class);
    Step secondStepNotPerformed = mock(Step.class);
    StepResult failed = failed("When I fail", new UUIDExceptionWrapper(new IllegalStateException()));
    StepResult notPerformed = notPerformed("Then I should not be performed");
    when(firstStepExceptional.perform(null)).thenReturn(failed);
    when(secondStepNotPerformed.doNotPerform(Matchers.<UUIDExceptionWrapper>any())).thenReturn(notPerformed);
    FailureStrategy failureStrategy = mock(FailureStrategy.class);
    StepCollector collector = mock(StepCollector.class);
    CandidateSteps mySteps = new Steps();
    Scenario scenario = new Scenario();
    when(collector.collectScenarioSteps(eq(asList(mySteps)), eq(scenario), eq(parameters))).thenReturn(
            asList(firstStepExceptional, secondStepNotPerformed));
    Story story = new Story(asList(scenario));
    boolean givenStory = false;
    givenStoryWithNoBeforeOrAfterSteps(story, givenStory, collector, mySteps);

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

    // Then
    verify(firstStepExceptional).perform(null);
    verify(secondStepNotPerformed).doNotPerform(Matchers.<UUIDExceptionWrapper>any());

    InOrder inOrder = inOrder(reporter, failureStrategy);
    inOrder.verify(reporter).beforeStory((Story) anyObject(), eq(givenStory));
    inOrder.verify(reporter).beforeScenario((String) anyObject());
    inOrder.verify(reporter).failed("When I fail", failed.getFailure());
    inOrder.verify(reporter).notPerformed("Then I should not be performed");
    inOrder.verify(reporter).afterScenario();
    inOrder.verify(reporter).afterStory(givenStory);
    inOrder.verify(failureStrategy).handleFailure(failed.getFailure());
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:38,代码来源:StoryRunnerBehaviour.java


示例13: shouldAllowToSkipScenariosAfterFailedScenario

import org.jbehave.core.steps.Steps; //导入依赖的package包/类
@Test
public void shouldAllowToSkipScenariosAfterFailedScenario() throws Throwable {
    // Given
    StoryReporter reporter = mock(ConcurrentStoryReporter.class);
    Step failedStep = mock(Step.class);
    Step neverExecutedStep = mock(Step.class);
    StepResult failed = failed("When I fail", new UUIDExceptionWrapper(new IllegalStateException()));
    when(failedStep.perform(null)).thenReturn(failed);
    FailureStrategy failureStrategy = mock(FailureStrategy.class);
    StepCollector collector = mock(StepCollector.class);
    CandidateSteps mySteps = new Steps();
    Scenario scenario1 = new Scenario();
    when(collector.collectScenarioSteps(eq(asList(mySteps)), eq(scenario1), eq(parameters))).thenReturn(
            asList(failedStep));
    Scenario scenario2 = new Scenario();
    when(collector.collectScenarioSteps(eq(asList(mySteps)), eq(scenario2), eq(parameters))).thenReturn(
            asList(neverExecutedStep));
    Story story = new Story(asList(scenario1, scenario2));
    givenStoryWithNoBeforeOrAfterSteps(story, false, collector, mySteps);

    // When
    StoryRunner runner = new StoryRunner();
    Configuration configuration = configurationWith(reporter, collector, failureStrategy);
    configuration.storyControls().doSkipScenariosAfterFailure(true);
    runner.run(configuration, asList(mySteps), story);

    // Then
    verify(failedStep).perform(null);
    verify(neverExecutedStep, never()).perform(null);

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


示例14: shouldResetStateBeforeScenario

import org.jbehave.core.steps.Steps; //导入依赖的package包/类
@Test
public void shouldResetStateBeforeScenario() throws Throwable {
    // Given
    StoryReporter reporter = mock(ConcurrentStoryReporter.class);
    Step pendingStep = mock(Step.class);
    when(pendingStep.perform(null)).thenReturn(pending("pendingStep"));
    Step secondStep = mockSuccessfulStep("secondStep");
    StepCollector collector = mock(StepCollector.class);
    CandidateSteps mySteps = new Steps();
    Scenario scenario1 = new Scenario();
    Scenario scenario2 = new Scenario();
    when(collector.collectScenarioSteps(asList(mySteps), scenario1, parameters)).thenReturn(asList(pendingStep));
    when(collector.collectScenarioSteps(asList(mySteps), scenario2, parameters)).thenReturn(asList(secondStep));
    Story story = new Story(asList(scenario1, scenario2));
    givenStoryWithNoBeforeOrAfterSteps(story, false, collector, mySteps);

    // When
    StoryRunner runner = new StoryRunner();
    Configuration configuration = configurationWith(reporter, collector);
    configuration.storyControls().doResetStateBeforeScenario(true);
    runner.run(configuration, asList(mySteps), story);

    // Then
    verify(pendingStep).perform(Matchers.<UUIDExceptionWrapper>any());
    verify(secondStep).perform(Matchers.<UUIDExceptionWrapper>any());
    verify(secondStep, never()).doNotPerform(Matchers.<UUIDExceptionWrapper>any());
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:28,代码来源:StoryRunnerBehaviour.java


示例15: shouldAllowToNotResetStateBeforeScenario

import org.jbehave.core.steps.Steps; //导入依赖的package包/类
@Test
public void shouldAllowToNotResetStateBeforeScenario() throws Throwable {
    // Given
    StoryReporter reporter = mock(ConcurrentStoryReporter.class);
    Step pendingStep = mock(Step.class);
    when(pendingStep.perform(null)).thenReturn(pending("pendingStep"));
    Step secondStep = mockSuccessfulStep("secondStep");
    StepCollector collector = mock(StepCollector.class);
    CandidateSteps mySteps = new Steps();
    Scenario scenario1 = new Scenario();
    Scenario scenario2 = new Scenario();
    when(collector.collectScenarioSteps(asList(mySteps), scenario1, parameters)).thenReturn(asList(pendingStep));
    when(collector.collectScenarioSteps(asList(mySteps), scenario2, parameters)).thenReturn(asList(secondStep));
    Story story = new Story(asList(scenario1, scenario2));
    givenStoryWithNoBeforeOrAfterSteps(story, false, collector, mySteps);

    // When
    StoryRunner runner = new StoryRunner();
    Configuration configuration = configurationWith(reporter, collector);
    configuration.storyControls().doResetStateBeforeScenario(false);
    runner.run(configuration, asList(mySteps), story);

    // Then
    verify(pendingStep).perform(Matchers.<UUIDExceptionWrapper>any());
    verify(secondStep).doNotPerform(Matchers.<UUIDExceptionWrapper>any());
    verify(secondStep, never()).perform(Matchers.<UUIDExceptionWrapper>any());
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:28,代码来源:StoryRunnerBehaviour.java


示例16: shouldAllowToNotResetStateBeforeStory

import org.jbehave.core.steps.Steps; //导入依赖的package包/类
@Test
public void shouldAllowToNotResetStateBeforeStory() throws Throwable {
    // Given
    StoryReporter reporter = mock(ConcurrentStoryReporter.class);
    Step failedStep = mock(Step.class, "failedStep");
    when(failedStep.perform(null)).thenReturn(failed("before stories", new UUIDExceptionWrapper(new RuntimeException("BeforeStories fail"))));
    Step pendingStep = mock(Step.class, "pendingStep");
    when(pendingStep.perform(null)).thenReturn(pending("pendingStep"));
    StepCollector collector = mock(StepCollector.class);
    CandidateSteps mySteps = new Steps();        
    Scenario scenario1 = new Scenario();
    List<CandidateSteps> candidateSteps = asList(mySteps);
    when(collector.collectBeforeOrAfterStoriesSteps(candidateSteps, Stage.BEFORE)).thenReturn(asList(failedStep));
    when(collector.collectScenarioSteps(candidateSteps, scenario1, parameters)).thenReturn(asList(pendingStep));
    Story story = new Story(asList(scenario1));
    givenStoryWithNoBeforeOrAfterSteps(story, false, collector, mySteps);

    // When
    StoryRunner runner = new StoryRunner();
    Configuration configuration = configurationWith(reporter, collector);
    configuration.storyControls().doResetStateBeforeStory(false).doResetStateBeforeScenario(false);
    runner.runBeforeOrAfterStories(configuration, candidateSteps, Stage.BEFORE);
    runner.run(configuration, candidateSteps, story);

    // Then
    verify(failedStep).perform(Matchers.<UUIDExceptionWrapper>any());
    verify(pendingStep).perform(Matchers.<UUIDExceptionWrapper>any());
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:29,代码来源:StoryRunnerBehaviour.java


示例17: shouldRunScenarioWithExamplesTable

import org.jbehave.core.steps.Steps; //导入依赖的package包/类
@Test
public void shouldRunScenarioWithExamplesTable() throws Throwable {
    // Given
    ExamplesTable examplesTable = new ExamplesTable("|one|two|\n|1|2|\n");
    Map<String, String> tableRow = examplesTable.getRow(0);
    Scenario scenario1 = new Scenario("my title 1", Meta.EMPTY, GivenStories.EMPTY, examplesTable, asList("step <one>",
            "step <two>"));
    Story story = new Story(new Description("my blurb"), Narrative.EMPTY, asList(scenario1));
    Step step = mock(Step.class);
    StepResult result = mock(StepResult.class);
    when(step.perform(null)).thenReturn(result);
    StoryReporter reporter = mock(ConcurrentStoryReporter.class);
    StepCollector collector = mock(StepCollector.class);
    FailureStrategy failureStrategy = mock(FailureStrategy.class);
    Configuration configuration = configurationWith(reporter, collector, failureStrategy);
    configuration.storyControls().doDryRun(true);
    CandidateSteps mySteps = new Steps(configuration);
    Step firstStep = mockSuccessfulStep("step <one>");
    Step secondStep = mockSuccessfulStep("step <two>");
    when(collector.collectScenarioSteps(asList(mySteps), scenario1,tableRow)).thenReturn(
            asList(firstStep, secondStep));
    boolean givenStory = false;
    givenStoryWithNoBeforeOrAfterSteps(story, givenStory, collector, mySteps);

    // When
    StoryRunner runner = new StoryRunner();
    runner.run(configuration, asList(mySteps), story);

    // Then
    InOrder inOrder = inOrder(reporter, failureStrategy);
    inOrder.verify(reporter).beforeStory(story, givenStory);
    inOrder.verify(reporter).beforeScenario("my title 1");
    inOrder.verify(reporter).successful("step <one>");
    inOrder.verify(reporter).successful("step <two>");
    inOrder.verify(reporter).afterScenario();
    inOrder.verify(reporter).afterStory(givenStory);
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:38,代码来源:StoryRunnerBehaviour.java


示例18: shouldNotRunScenariosNotAllowedByFilterOnScenarioElement

import org.jbehave.core.steps.Steps; //导入依赖的package包/类
@Test
public void shouldNotRunScenariosNotAllowedByFilterOnScenarioElement() 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("", Description.EMPTY, Meta.EMPTY, Narrative.EMPTY, asList(new Scenario("excluded_title", Meta.EMPTY, GivenStories.EMPTY, ExamplesTable.EMPTY, asList(""))));
    boolean givenStory = false;
    givenStoryWithNoBeforeOrAfterSteps(story, givenStory, collector, mySteps);
    String filterAsString = "-scenario_title excluded_title";
    MetaFilter filter = new MetaFilter(filterAsString);

    // When
    StoryRunner runner = new StoryRunner();
    Configuration configuration = configurationWith(reporter, collector, strategy);
    configuration.storyControls().useScenarioMetaPrefix("scenario_");
    runner.run(configuration, asList(mySteps), story, filter);

    // Then
    verify(reporter).beforeStory(story, givenStory);
    verify(reporter).beforeScenario("excluded_title");
    verify(reporter).scenarioNotAllowed(story.getScenarios().get(0), filterAsString);
    verify(reporter).afterScenario();
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:28,代码来源:StoryRunnerBehaviour.java


示例19: assertThatStepsInstancesAre

import org.jbehave.core.steps.Steps; //导入依赖的package包/类
private void assertThatStepsInstancesAre(List<CandidateSteps> candidateSteps, Class<?>... stepsClasses) {
    for (Class<?> stepsClass : stepsClasses) {
        boolean found = false;
        for (CandidateSteps steps : candidateSteps) {
            Object instance = ((Steps) steps).instance();
            if (instance.getClass() == stepsClass) {
                found = true;
            }
        }
        assertThat(found, is(true));
    }
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:13,代码来源:AnnotationBuilderBehaviour.java


示例20: firstStepsInstance

import org.jbehave.core.steps.Steps; //导入依赖的package包/类
private Object firstStepsInstance(List<CandidateSteps> steps) {
    return ((Steps) steps.get(0)).instance();
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:4,代码来源:SpringStepsFactoryBehaviour.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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