One of the minor problems I have had so far is that the browser windows don't get closed after my tests completed.
I saw a number of attempts at solving this including having a tagged @After hook on the last scenario in the last Feature. None of them really jumped out at me until I read a question to the group and that led me to give a JVM shutdown hooks a go (equivalent to Kernel#at_exit in Ruby land). That seems to work quite well and lives well away from the features and steps making for cleaner code. It also means that we will have a clean suite of features that don't get polluted by technical detail.
Do take a look at the full thing on GitHub. Let me know what you think.
2 comments:
Just tried out your hook-solution. Didn't work out for me (running cuke4duke with FF under maven2) :-( Hook is fired after I close the browser manually.
So I came up with a tear-down thread, started on each @After szenario, shutting down the browser if no @Before is done within a defined time.
regards
Chris
Yeah its a bit strange. I found out painfully that it didn't work on Windows.
Wonder whether the error lies in Maven or in the shutdown hook functionality in Java.
I think I also like your @Before and @After solution. Have you got it in a Gist somewhere?
Post a Comment