Swing testing - issues with Before/After
13 Dec 2012, 03:28
Brett Giles (1 post)
Hi all – I had issues with following recipe 22 as laid out for a non-trivial project. Technology was JRuby 1.7 with Monkeybars 1.1.2 and Java 1.6.
I found that using the Before and After hooks failed. The failure was only apparent when running a second scenario – a single scenario would run fine. (I’m not sure of the failure reason – possibly because the fest robot was kept around?). For my app, I had to do an Around hook as follows:
Around do |sc, blk| runner = GuiActionRunner.execute(AppStarter.new) $robot = BasicRobot.robot_with_current_awt_hierarchy $qe_frame = FrameFixture.new($robot, "Quantum Emulator") blk.call $robot.clean_up $robot = nil $qe_frame = nil LqplController.instance.close end
(LqplController is a Monkeybars controller – closing it shuts down the app).
Complete (in-progress) code is at https://bitbucket.org/BrettGilesUofC/lqpl/src
31 Dec 2012, 19:58
Ian Dees (192 posts)
Thanks for letting us know. I’ve updated the recipe to use a single long-running instance of the PresentationClock app instead of stopping/restarting it.
Thanks also for the link to the LQPL project. What a great polyglot project: back end in Haskell, front end in Java and Ruby, and test scripts in Cucumber!
Wishing you a Happy New Year,
|You must be logged in to comment|