lambdaisland / kaocha-cucumber

Cucumber support for Kaocha
Eclipse Public License 1.0
38 stars 11 forks source link

Consider Supporting @Before and @After Hooks #1

Closed ThompsonJonM closed 5 years ago

ThompsonJonM commented 5 years ago

I've looked into Cucumber-JVM-Clojure support for Before and After hooks and found that the guts of the the Cucumber-JVM-Clojure clj.clj file are very similar to the Kaocha-Cucumber dsl file. Writing a Before and After hook in Cucumber-JVM-Clojure should appear as so:

(Before [{optional tag here}] {body text here})

I've tried this with Kaocha-Cucumber and found that it did not seem to work for reasons that I have not yet determined.

I would love to see about implementing an After hook to screenshot upon test or step failure. Our current set up is using Kaocha, Kaocha-Cucumber, and Etaoin as a webdriver.

Thank you for your time!

plexus commented 5 years ago

Hi @ThompsonJonM, I just tried it out here: https://github.com/lambdaisland/kaocha-demo

Clone that repository and run bin/kaocha features --no-capture-output --reporter documentation, you will see it print "in before hook" and "in after hook".

Do note that by default Kaocha only shows output generated by failing tests, so if you do a print or println you might not see the result. You can disable this with --no-capture-output, or in tests.edn with :kaocha.plugin.capture-output/capture-output? false. Is it possible that maybe that's why it doesn't appear to be working?

If you can't get it to work then it would be most helpful if you could set up a (minimal) demo repository that reproduces the issue you're seeing.

ThompsonJonM commented 5 years ago

Hi @plexus, both before and after hooks are working per your guidance. I'd say it is safe to close this out.

Thank you!