Skip to content

Commit

Permalink
GEB-314 Fix for functional tests implemented using JUnit and Geb runn…
Browse files Browse the repository at this point in the history
…ing twice in Grails 2.3+
  • Loading branch information
erdi committed Oct 16, 2014
1 parent da6cfab commit e223716
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions doc/manual/src/chapters/140-project.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ This page lists the high level changes between versions of Geb.
* Added `$()` method on Navigator with all signatures of `find()`. \[[GEB-321](http://jira.codehaus.org/browse/GEB-321)\]
* `geb-saucelabs` plugin now uses a native version of SauceConnect. \[[GEB-341](http://jira.codehaus.org/browse/GEB-341)\]
* Don't modify the predicate map passed to [`Navigator.find(Map<String, Object>, String)`](api/geb/navigator/Navigator.html#find\(Map%3CString,%20Object%3E,%20java.lang.String\)). \[[GEB-339](http://jira.codehaus.org/browse/GEB-339)\]
* Functional tests implemented using JUnit and Geb run twice in Grails 2.3+. \[[GEB-314](http://jira.codehaus.org/browse/GEB-314)\]

#### Project Related Changes

Expand Down
16 changes: 10 additions & 6 deletions integration/geb-grails/scripts/_Events.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,16 @@ eventAllTestsStart = {
runningTests = true

tryToLoadTestTypes()

[junit3TestTypeClassName, junit4TestTypeClassName].each { testTypeClassName ->
def testTypeClass = softLoadClass(testTypeClassName)
if (testTypeClass) {
if (!functionalTests.any { it.class == testTypeClass }) {
functionalTests << testTypeClass.newInstance('functional', 'functional')

// The Spock test type in Grails 2.3+ will run JUnit tests as well, so don't register the JUnit test
// types to avoid running JUnit tests twice when using Grails 2.3+
if (!softLoadClass(coreSpecTestTypeClassName)) {
[junit3TestTypeClassName, junit4TestTypeClassName].each { testTypeClassName ->
def testTypeClass = softLoadClass(testTypeClassName)
if (testTypeClass) {
if (!functionalTests.any { it.class == testTypeClass }) {
functionalTests << testTypeClass.newInstance('functional', 'functional')
}
}
}
}
Expand Down

0 comments on commit e223716

Please sign in to comment.