本文整理汇总了Java中org.jbehave.core.annotations.AfterScenario类的典型用法代码示例。如果您正苦于以下问题:Java AfterScenario类的具体用法?Java AfterScenario怎么用?Java AfterScenario使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AfterScenario类属于org.jbehave.core.annotations包,在下文中一共展示了AfterScenario类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldInvokeAfterStepUponAnyOutcomeMethodWithExpectedParametersFromMeta
import org.jbehave.core.annotations.AfterScenario; //导入依赖的package包/类
@Test
public void shouldInvokeAfterStepUponAnyOutcomeMethodWithExpectedParametersFromMeta() throws Exception {
// Given
SomeSteps stepsInstance = new SomeSteps();
StepCreator stepCreator = stepCreatorUsing(stepsInstance, mock(StepMatcher.class), new ParameterControls());
Properties properties = new Properties();
properties.put("theme", "shopping cart");
properties.put("variant", "book");
// When
Step stepWithMeta = stepCreator.createAfterStepUponOutcome(SomeSteps.methodFor("aMethodWithANamedParameter"),
AfterScenario.Outcome.ANY, new Meta(properties));
StepResult stepResult = stepWithMeta.perform(null);
// Then
assertThat(stepResult, instanceOf(Skipped.class));
assertThat(stepsInstance.args, instanceOf(Map.class));
@SuppressWarnings("unchecked")
Map<String, String> methodArgs = (Map<String, String>) stepsInstance.args;
assertThat(methodArgs.get("variant"), is("book"));
assertThat(methodArgs.get("theme"), is("shopping cart"));
}
示例2: shouldInvokeAfterStepUponSuccessOutcomeMethodIfNoFailureOccurred
import org.jbehave.core.annotations.AfterScenario; //导入依赖的package包/类
@Test
public void shouldInvokeAfterStepUponSuccessOutcomeMethodIfNoFailureOccurred() throws Exception {
// Given
SomeSteps stepsInstance = new SomeSteps();
StepCreator stepCreator = stepCreatorUsing(stepsInstance, mock(StepMatcher.class), new ParameterControls());
Properties properties = new Properties();
properties.put("theme", "shopping cart");
properties.put("variant", "book");
// When
Step stepWithMeta = stepCreator.createAfterStepUponOutcome(SomeSteps.methodFor("aMethodWithANamedParameter"),
AfterScenario.Outcome.SUCCESS, new Meta(properties));
StepResult stepResult = stepWithMeta.perform(null);
// Then
assertThat(stepResult, instanceOf(Skipped.class));
assertThat(stepsInstance.args, instanceOf(Map.class));
@SuppressWarnings("unchecked")
Map<String, String> methodArgs = (Map<String, String>) stepsInstance.args;
assertThat(methodArgs.get("variant"), is("book"));
assertThat(methodArgs.get("theme"), is("shopping cart"));
}
示例3: shouldInvokeAfterStepUponFailureOutcomeMethodIfFailureOccurred
import org.jbehave.core.annotations.AfterScenario; //导入依赖的package包/类
@Test
public void shouldInvokeAfterStepUponFailureOutcomeMethodIfFailureOccurred() throws Exception {
// Given
SomeSteps stepsInstance = new SomeSteps();
StepCreator stepCreator = stepCreatorUsing(stepsInstance, mock(StepMatcher.class), new ParameterControls());
Properties properties = new Properties();
properties.put("theme", "shopping cart");
properties.put("variant", "book");
// When
Step stepWithMeta = stepCreator.createAfterStepUponOutcome(SomeSteps.methodFor("aMethodWithANamedParameter"),
AfterScenario.Outcome.FAILURE, new Meta(properties));
StepResult stepResult = stepWithMeta.doNotPerform(null);
// Then
assertThat(stepResult, instanceOf(Skipped.class));
assertThat(stepsInstance.args, instanceOf(Map.class));
@SuppressWarnings("unchecked")
Map<String, String> methodArgs = (Map<String, String>) stepsInstance.args;
assertThat(methodArgs.get("variant"), is("book"));
assertThat(methodArgs.get("theme"), is("shopping cart"));
}
示例4: teardown
import org.jbehave.core.annotations.AfterScenario; //导入依赖的package包/类
@AfterScenario
public void teardown() throws Throwable {
try {
ThreadContext.get().verify();
ThreadContext.get().teardown();
} catch (Throwable e) {
e.printStackTrace(); // Ensures output in Eclipse console
throw e;
}
}
示例5: afterScenario
import org.jbehave.core.annotations.AfterScenario; //导入依赖的package包/类
@AfterScenario(uponType = ScenarioType.ANY)
public void afterScenario() throws Exception {
umountSMB(RaqetConfig.MOUNTPATH2);
umountSMB(RaqetConfig.MOUNTPATH);
_config.getServer().stop();
Thread.sleep(1000);
}
示例6: afterScenario
import org.jbehave.core.annotations.AfterScenario; //导入依赖的package包/类
@AfterScenario
public void afterScenario(@Named("variant") String variant, @Named("theme") String theme) {
if (variant.length() > 0 && theme.length() > 0) {
System.out.println("After scenario with variant '" + variant + "' and theme '" + theme + "'.");
} else {
System.out.println("After Any Scenario ...");
}
}
示例7: afterFailedScenario
import org.jbehave.core.annotations.AfterScenario; //导入依赖的package包/类
@AfterScenario(uponOutcome = Outcome.FAILURE)
public void afterFailedScenario(@Named("theme") String theme) {
if ("parametrisation".equals(theme)) {
System.out.println("Wow, something failed in a scenario with theme 'parametrisation'.");
} else {
System.out.println("After Failed Scenario ...");
}
}
示例8: afterScenarioFailure
import org.jbehave.core.annotations.AfterScenario; //导入依赖的package包/类
@AfterScenario(uponOutcome = Outcome.FAILURE)
public void afterScenarioFailure(UUIDExceptionWrapper failure) throws Exception {
System.out.println("After Failed Scenario ...");
File file = new File("target/failures/"+failure.getUUID().toString());
file.getParentFile().mkdirs();
file.createNewFile();
failures.add(file.toString());
System.out.println("Failure: "+file);
}
示例9: scenarioType
import org.jbehave.core.annotations.AfterScenario; //导入依赖的package包/类
private ScenarioType scenarioType(Method method, Class<? extends Annotation> annotationClass) {
if (annotationClass.isAssignableFrom(BeforeScenario.class)) {
return ((BeforeScenario) method.getAnnotation(annotationClass)).uponType();
}
if (annotationClass.isAssignableFrom(AfterScenario.class)) {
return ((AfterScenario) method.getAnnotation(annotationClass)).uponType();
}
return ScenarioType.NORMAL;
}
示例10: shouldNotInvokeAfterStepUponSuccessOutcomeMethodIfFailureOccurred
import org.jbehave.core.annotations.AfterScenario; //导入依赖的package包/类
@Test
public void shouldNotInvokeAfterStepUponSuccessOutcomeMethodIfFailureOccurred() throws Exception {
// Given
SomeSteps stepsInstance = new SomeSteps();
StepCreator stepCreator = stepCreatorUsing(stepsInstance, mock(StepMatcher.class), new ParameterControls());
// When
Step stepWithMeta = stepCreator.createAfterStepUponOutcome(SomeSteps.methodFor("aFailingMethod"),
AfterScenario.Outcome.SUCCESS, mock(Meta.class));
StepResult stepResult = stepWithMeta.doNotPerform(null);
// Then
assertThat(stepResult, instanceOf(Skipped.class));
}
示例11: shouldNotInvokeAfterStepUponFailureOutcomeMethodIfNoFailureOccurred
import org.jbehave.core.annotations.AfterScenario; //导入依赖的package包/类
@Test
public void shouldNotInvokeAfterStepUponFailureOutcomeMethodIfNoFailureOccurred() throws Exception {
// Given
SomeSteps stepsInstance = new SomeSteps();
StepCreator stepCreator = stepCreatorUsing(stepsInstance, mock(StepMatcher.class), new ParameterControls());
// When
Step stepWithMeta = stepCreator.createAfterStepUponOutcome(SomeSteps.methodFor("aFailingMethod"),
AfterScenario.Outcome.FAILURE, mock(Meta.class));
StepResult stepResult = stepWithMeta.perform(null);
// Then
assertThat(stepResult, instanceOf(Skipped.class));
}
示例12: shouldPassMetaToStepCreatorWhenCreatingStepUponOutcomeWithMeta
import org.jbehave.core.annotations.AfterScenario; //导入依赖的package包/类
@Test
public void shouldPassMetaToStepCreatorWhenCreatingStepUponOutcomeWithMeta() throws Exception {
StepCreator stepCreator = mock(StepCreator.class);
Method method = methodFor("aMethodWith");
BeforeOrAfterStep beforeOrAfterStep = new BeforeOrAfterStep(Stage.AFTER, method, stepCreator);
Meta meta = mock(Meta.class);
beforeOrAfterStep.createStepUponOutcome(meta);
verify(stepCreator).createAfterStepUponOutcome(method, AfterScenario.Outcome.ANY, meta);
}
示例13: afterScenario
import org.jbehave.core.annotations.AfterScenario; //导入依赖的package包/类
@AfterScenario
public void afterScenario() {
}
示例14: afterScenario
import org.jbehave.core.annotations.AfterScenario; //导入依赖的package包/类
@AfterScenario
public void afterScenario() {
kfMonitor.stop();
}
示例15: afterScenario
import org.jbehave.core.annotations.AfterScenario; //导入依赖的package包/类
@AfterScenario
public void afterScenario() {
zkMonitor.stop();
}