Closed vgt1337 closed 3 years ago
Hi @vgt1337
Did you try using the AfterStep
cucumber hook?
You can add something like this:
@AfterStep
public void afterStep(Scenario scenario) {
if (scenario.isFailed()) {
// take screenshot here
}
}
You wrote "Each feature / scenario is run using the Cucumber CLI and because of this JUnit is not notified off the result whilst the tests are being executed." - is it fixed?
JUnit is currently notified of the result after all tests are run.
Yes, this way also added attachments in TearDown method
You will have to embed the screenshot in the step definition although I would not recommend this approach.
@Given("step will fail sometimes")
public void stepWithFailure() {
scenario.attach(...);
}
It's unlikely you will know when a step will fail so it's best to capture the (failed) state of your application (i.e. image attachment) in a hook.
Courgette uses the allure-cucumber6-jvm plugin so all allure report features are defined in this plugin.
Good day, Prashant! Can you help me with add attachment in allure report right in failed step not in TearDown methods? You wrote "Each feature / scenario is run using the Cucumber CLI and because of this JUnit is not notified off the result whilst the tests are being executed." - is it fixed?