com.consol.citrus.dsl.design.TestDesigner Java Examples

The following examples show how to use com.consol.citrus.dsl.design.TestDesigner. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AllureCitrusTest.java    From allure-java with Apache License 2.0 6 votes vote down vote up
@Step("Run test case {testDesigner}")
private AllureResults run(final TestDesigner testDesigner) {
    final AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(
            CitrusSpringConfig.class, AllureCitrusConfig.class
    );
    final Citrus citrus = Citrus.newInstance(applicationContext);
    final TestContext testContext = citrus.createTestContext();

    final TestActionListeners listeners = applicationContext.getBean(TestActionListeners.class);
    final AllureLifecycle defaultLifecycle = Allure.getLifecycle();
    final AllureLifecycle lifecycle = applicationContext.getBean(AllureLifecycle.class);
    try {
        Allure.setLifecycle(lifecycle);
        final TestCase testCase = testDesigner.getTestCase();
        testCase.setTestActionListeners(listeners);

        citrus.run(testCase, testContext);
    } catch (Exception ignored) {
    } finally {
        Allure.setLifecycle(defaultLifecycle);
    }

    return applicationContext.getBean(AllureResultsWriterStub.class);
}
 
Example #2
Source File: ScenarioExecutionService.java    From citrus-simulator with Apache License 2.0 5 votes vote down vote up
/**
 * Adds a new variable to the testExecutable using the supplied key an value.
 *
 * @param scenario
 * @param key      variable name
 * @param value    variable value
 */
private void addVariable(SimulatorScenario scenario, String key, Object value) {
    if (scenario instanceof TestDesigner) {
        ((TestDesigner) scenario).variable(key, value);
    }

    if (scenario instanceof TestRunner) {
        ((TestRunner) scenario).variable(key, value);
    }
}