prashant-ramcharan / courgette-jvm

Multiprocess | Parallel Cucumber-JVM | Parallelize your Java Cucumber tests on a feature level or on a scenario level.
MIT License
133 stars 39 forks source link

Cucumber scenario not appending written strings #115

Closed papsicle closed 5 years ago

papsicle commented 5 years ago

Hi,

I used to only have Cucumber run setup and used the @Before and @After annotations to do some general dataSetup/cleanup around each tests. I also used the @After to append the exact query to rerun that exact failing scenario. This has been used to try to reproduce issues that appeared on automation environments. The code looks like:

@After()
public void tearDown(Scenario scenario) {
    if (scenario.isFailed()) {
        scenario.write(String.format("./gradlew clean test [...]");
    }
    // More data cleanup after
    [...]
}

This, in the Cucumber.xml report, showed up as

./gradlew clean test [...]

Given data setup ...................................................passed
When some action is performed............................failed
Then something happens......................................skipped

After replacing my Cucumber test run with a Courgette test run, this scenario.write() seems to no longer be doing anything. However, the tearDown method is clearly called since the data cleanup is properly executed.

Do you have any clue what could be causing this? Your help would be highly appreciated as this is a nice to have that we've gotten used too.

Thanks!

prashant-ramcharan commented 5 years ago

Hello,

Courgette does not change the behaviour of Cucumber so I'm not sure why this is causing an issue for you.

I was not able to reproduce this either. I tried with the Courgette example project and updated this line: https://github.com/prashant-ramcharan/courgette-jvm-example/blob/master/src/test/java/steps/TestSteps.java#L29

Screenshot 2019-05-22 at 19 43 51 Screenshot 2019-05-22 at 19 44 26
papsicle commented 5 years ago

I was actually looking for a way to get this information in the cucumber .xml export since that's what our previous tools what using. However, I just discover the way to do that was actually to implement a custom JUnitFormatter and print that cucumber export file in a custom way (appending the line where it's needed).

Sorry to have bothered you with this, I didn't understand the framework properly.

Thanks for the fast response though!