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


Java AfterScenario类代码示例

本文整理汇总了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"));
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:24,代码来源:StepCreatorBehaviour.java

示例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"));
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:24,代码来源:StepCreatorBehaviour.java

示例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"));
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:24,代码来源:StepCreatorBehaviour.java

示例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;
	}
}
 
开发者ID:wmaop,项目名称:wm-jbehave,代码行数:11,代码来源:WmJBehaveSteps.java

示例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);
}
 
开发者ID:raqet,项目名称:acquisition-server,代码行数:8,代码来源:BeforeAfterSteps.java

示例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 ...");
    }
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:9,代码来源:BeforeAfterSteps.java

示例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 ...");
    }
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:9,代码来源:BeforeAfterSteps.java

示例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);
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:10,代码来源:FailureCorrelationStories.java

示例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;
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:10,代码来源:Steps.java

示例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));
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:15,代码来源:StepCreatorBehaviour.java

示例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));
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:15,代码来源:StepCreatorBehaviour.java

示例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);
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:13,代码来源:BeforeOrAfterStepBehaviour.java

示例13: afterScenario

import org.jbehave.core.annotations.AfterScenario; //导入依赖的package包/类
@AfterScenario
public void afterScenario() {
}
 
开发者ID:mcafee,项目名称:management-sdk-for-kafka,代码行数:4,代码来源:ZookeeperMonitorSteps.java

示例14: afterScenario

import org.jbehave.core.annotations.AfterScenario; //导入依赖的package包/类
@AfterScenario
public void afterScenario() {
    kfMonitor.stop();
}
 
开发者ID:mcafee,项目名称:management-sdk-for-kafka,代码行数:5,代码来源:KafkaMonitorSteps.java

示例15: afterScenario

import org.jbehave.core.annotations.AfterScenario; //导入依赖的package包/类
@AfterScenario
public void afterScenario() {
    zkMonitor.stop();
}
 
开发者ID:mcafee,项目名称:management-sdk-for-kafka,代码行数:5,代码来源:ZookeeperMonitorEventSteps.java


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