Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
JUnit tests run twice in Grails 2.3 #314
Originally created by Craig Atkinson.
Originally found by github user 'domurtag' and reported in a Geb sample project craigatk/geb-example#1, JUnit Geb tests are running twice in Grails 2.3 projects. From looking at the test execution, it looks like both Spock and JUnit are running the JUnit tests, resulting in the duplicate execution. The problem can be reproduced with the Github project https://github.com/craigatk/geb-example
I looked into the test class names run by GrailsSpecTestType built in to Grails 2.3 and the one in the Spock plugin, and the one built in to Grails 2.3 runs tests ending in 'Test' and 'Tests', whereas the one in the Spock plugin does not.
GrailsSpecTestType in Grails 2.3
GrailsSpecTestType in Spock plugin (Grails 2.2 and below)
I was able to work around the issue by tweaking the test type registration in _Events.groovy in the Geb-Grails plugin:
If this seems like a reasonable solution, let me know and I'll put together a pull request with the changes.
Originally posted by Lari Hotari.
Craig, I think it's worth sending a pull request for your change. This is a problem for Grails 2.3+ with Geb plugin versions 0.9.2+ . I just came across the same problem and documented my similar findings in SO http://stackoverflow.com/questions/14404892/geb-firefox-driver-why-my-test-runs-twice/24880397#24880397 .