use of com.consol.citrus.Citrus in project allure-java by allure-framework.
the class AllureCitrusTest method run.
@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);
}
Aggregations