0
votes

I am testing an API rest using the Citrus framework and the features: Cucumber, DSL, Spring, HTTP. I am with a problem that for each Scenario I need to create a new object of "DefaultTestRunner" to execute my scenarios(like this answer, How to integration Citrus framework and BBD Cucumber). I would like to know if there is some alternative that I could implement that is not necessary to copy the @Before and every scenario create a new citrus instance, for each java class feature.

@Before
public void setUp(Scenario scenario) {
    citrus = Citrus.newInstance();
    runner = new DefaultTestRunner(citrus.getApplicationContext(), citrus.createTestContext());
}
1

1 Answers

0
votes

Please have a look at the citrus-cucumber module. It provides a special integration for Citrus in Cucumber and will do the handling of all components for you.

See the module and examples here: https://github.com/citrusframework/citrus/tree/master/runtime/citrus-cucumber

https://github.com/citrusframework/citrus-samples/tree/master/samples-cucumber