本文整理汇总了Java中org.jbehave.core.steps.CandidateSteps类的典型用法代码示例。如果您正苦于以下问题:Java CandidateSteps类的具体用法?Java CandidateSteps怎么用?Java CandidateSteps使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CandidateSteps类属于org.jbehave.core.steps包,在下文中一共展示了CandidateSteps类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: assertThatStepsCanBeCreated
import org.jbehave.core.steps.CandidateSteps; //导入依赖的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
示例2: assertThatStepsWithStepsWithDependencyCanBeCreated
import org.jbehave.core.steps.CandidateSteps; //导入依赖的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
示例3: reportStepdocsAsEmbeddables
import org.jbehave.core.steps.CandidateSteps; //导入依赖的package包/类
public void reportStepdocsAsEmbeddables(List<String> classNames) {
EmbedderControls embedderControls = embedderControls();
if (embedderControls.skip()) {
embedderMonitor.embeddablesSkipped(classNames);
return;
}
for (Embeddable embeddable : embeddables(classNames, classLoader())) {
if (embeddable instanceof ConfigurableEmbedder) {
ConfigurableEmbedder configurableEmbedder = (ConfigurableEmbedder) embeddable;
List<CandidateSteps> steps = configurableEmbedder.candidateSteps();
if (steps.isEmpty()) {
steps = configurableEmbedder.stepsFactory().createCandidateSteps();
}
reportStepdocs(configurableEmbedder.configuration(), steps);
} else {
embedderMonitor.embeddableNotConfigurable(embeddable.getClass().getName());
}
}
}
开发者ID:vactowb,项目名称:jbehave-core,代码行数:21,代码来源:Embedder.java
示例4: shouldRunASingleStory
import org.jbehave.core.steps.CandidateSteps; //导入依赖的package包/类
@Test
public void shouldRunASingleStory() 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(configuration, steps);
story.useEmbedder(embedder);
story.run();
// Then
verify(embedder).useConfiguration(configuration);
verify(embedder).useCandidateSteps(eq(asList(steps)));
verify(embedder).runStoriesAsPaths(asList(storyPath));
}
开发者ID:vactowb,项目名称:jbehave-core,代码行数:24,代码来源:ConfigurableEmbedderBehaviour.java
示例5: shouldAllowOverrideOfDefaultConfiguration
import org.jbehave.core.steps.CandidateSteps; //导入依赖的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
示例6: shouldAllowAdditionOfSteps
import org.jbehave.core.steps.CandidateSteps; //导入依赖的package包/类
@Test
public void shouldAllowAdditionOfSteps() 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(configuration, steps);
story.useEmbedder(embedder);
story.run();
// Then
verify(embedder).runStoriesAsPaths(asList(storyPath));
}
开发者ID:vactowb,项目名称:jbehave-core,代码行数:22,代码来源:ConfigurableEmbedderBehaviour.java
示例7: shouldRunStepsBeforeAndAfterStories
import org.jbehave.core.steps.CandidateSteps; //导入依赖的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
示例8: shouldRunBeforeAndAfterStorySteps
import org.jbehave.core.steps.CandidateSteps; //导入依赖的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
示例9: shouldHandlePendingStepsAccordingToStrategy
import org.jbehave.core.steps.CandidateSteps; //导入依赖的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
示例10: shouldFailWithFailingUpongPendingStepsStrategy
import org.jbehave.core.steps.CandidateSteps; //导入依赖的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
示例11: shouldNotRunStoriesNotAllowedByFilter
import org.jbehave.core.steps.CandidateSteps; //导入依赖的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
示例12: shouldNotRunStoriesNotAllowedByFilterOnStoryElement
import org.jbehave.core.steps.CandidateSteps; //导入依赖的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
示例13: shouldNotRunScenariosNotAllowedByFilter
import org.jbehave.core.steps.CandidateSteps; //导入依赖的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
示例14: shouldFindAndReportMatchingSteps
import org.jbehave.core.steps.CandidateSteps; //导入依赖的package包/类
@Test
public void shouldFindAndReportMatchingSteps() {
// Given
Embedder embedder = new Embedder();
embedder.useCandidateSteps(asList((CandidateSteps) new MySteps()));
embedder.configuration().useStepFinder(new StepFinder());
OutputStream out = new ByteArrayOutputStream();
embedder.configuration().useStepdocReporter(new PrintStreamStepdocReporter(new PrintStream(out)));
// When
embedder.reportMatchingStepdocs("Given a given");
// Then
String expected = "Step 'Given a given' is matched by annotated patterns:\n" + "'Given a given'\n"
+ "org.jbehave.core.embedder.EmbedderBehaviour$MySteps.given()\n" + "from steps instances:\n"
+ "org.jbehave.core.embedder.EmbedderBehaviour$MySteps\n";
assertThat(dos2unix(out.toString()), equalTo(expected));
}
开发者ID:vactowb,项目名称:jbehave-core,代码行数:17,代码来源:EmbedderBehaviour.java
示例15: shouldReportAllStepdocs
import org.jbehave.core.steps.CandidateSteps; //导入依赖的package包/类
@Test
public void shouldReportAllStepdocs() {
// Given
Embedder embedder = new Embedder();
embedder.useCandidateSteps(asList((CandidateSteps) new MySteps()));
embedder.configuration().useStepFinder(new StepFinder());
OutputStream out = new ByteArrayOutputStream();
embedder.configuration().useStepdocReporter(new PrintStreamStepdocReporter(new PrintStream(out)));
// When
embedder.reportStepdocs();
// Then
String output = dos2unix(out.toString());
assertThat(output, containsString("'Given a given'\n"
+ "org.jbehave.core.embedder.EmbedderBehaviour$MySteps.given()\n"));
assertThat(output, containsString("'When a when'\n"
+ "org.jbehave.core.embedder.EmbedderBehaviour$MySteps.when()\n"));
assertThat(output, containsString("'Then a then'\n"
+ "org.jbehave.core.embedder.EmbedderBehaviour$MySteps.then()\n"));
assertThat(output,
containsString("from steps instances:\norg.jbehave.core.embedder.EmbedderBehaviour$MySteps\n"));
}
开发者ID:vactowb,项目名称:jbehave-core,代码行数:22,代码来源:EmbedderBehaviour.java
示例16: run
import org.jbehave.core.steps.CandidateSteps; //导入依赖的package包/类
@Override
public void run() throws Throwable {
List<CandidateSteps> candidateSteps = new InstanceStepsFactory(configuration(), steps).createCandidateSteps();
useStepsFactory(new ProvidedStepsFactory(candidateSteps));
configuredEmbedder().runStoriesAsPaths(storyPaths());
}
开发者ID:tumbarumba,项目名称:jbehave-specification-report,代码行数:8,代码来源:JBehaveSpecificationBuilder.java
示例17: resolveCandidateSteps
import org.jbehave.core.steps.CandidateSteps; //导入依赖的package包/类
protected void resolveCandidateSteps(TestPage pageToTest, Embedder embedder) {
Collection<String> stepNames = new StepsBuilder().getSteps(pageToTest);
for (Object step : resolveClassInstances(stepNames)) {
if (step instanceof CandidateSteps) {
embedder.candidateSteps().add((CandidateSteps) step);
} else {
embedder.candidateSteps().addAll(new InstanceStepsFactory(embedder.configuration(), step).createCandidateSteps());
}
}
}
开发者ID:amolenaar,项目名称:fitnesse-jbehave-test-system,代码行数:12,代码来源:JBehaveTestSystem.java
示例18: createCandidateStepsWith
import org.jbehave.core.steps.CandidateSteps; //导入依赖的package包/类
private void createCandidateStepsWith(StepMonitor stepMonitor) {
// reset step monitor and recreate candidate steps
configuration.useStepMonitor(stepMonitor);
getCandidateSteps();
for (CandidateSteps step : candidateSteps) {
step.configuration().useStepMonitor(stepMonitor);
}
}
开发者ID:andreiserea,项目名称:arquillian-jbehave,代码行数:9,代码来源:ArquillianJbehaveRunner.java
示例19: stepsCanBeCreated
import org.jbehave.core.steps.CandidateSteps; //导入依赖的package包/类
@Test
public void stepsCanBeCreated() {
// Given
ApplicationContext context = createApplicationContext("org/jbehave/core/steps/spring/steps.xml");
SpringStepsFactory factory = new SpringStepsFactory(new MostUsefulConfiguration(), context);
// When
List<CandidateSteps> steps = factory.createCandidateSteps();
// Then
assertFooStepsFound(steps);
}
开发者ID:vactowb,项目名称:jbehave-core,代码行数:11,代码来源:SpringStepsFactoryBehaviour.java
示例20: annotationStepsCanBeCreated
import org.jbehave.core.steps.CandidateSteps; //导入依赖的package包/类
@Test
public void annotationStepsCanBeCreated() throws Exception {
// Given
ApplicationContext context = createApplicationContext(StepsAnnotationConfiguration.class.getName());
SpringStepsFactory factory = new SpringStepsFactory(new MostUsefulConfiguration(), context);
// When
List<CandidateSteps> steps = factory.createCandidateSteps();
// Then
assertFooStepsFound(steps);
}
开发者ID:vactowb,项目名称:jbehave-core,代码行数:11,代码来源:SpringStepsFactoryBehaviour.java
注:本文中的org.jbehave.core.steps.CandidateSteps类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论