I am writing regression testing for a large web application created with Grails 2.3.5. The unit tests use spock framework, the integration tests were written using JUnit framework, and functional tests use spock and geb. DbUnit is used with the integration and functional tests to provide a simple database to test. All tests run fine when calling:
grails test-app unit:
grails test-app functional:
grails test-app unit: functional:
grails test-app integration: functional:
grails test-app unit: aUnitTest integration: aTestController functional:
but when I call:
grails test-app
grails test-app unit: integration: functional:
the functional tests fail with this error:
junit.framework.AssertionFailedError: Condition not satisfied:
driver.currentUrl == urlPrefix + "/login"
| | | | |
| | | | http://localhost:8099/FOOBAR/login
| | | http://localhost:8099/FOOBAR
| | false
| | 19 differences (75% similarity)
| | http://localhost:8099/(GrailsUnitTestMixin)/login
| | http://localhost:8099/(FOOBAR)/login
| http://localhost:8099/GrailsUnitTestMixin/login
FirefoxDriver: firefox on XP (c9e919fe-1046-488a-af0f-25e9a572db3b)
at MySpec.Login with username and invalid password(MySpec.groovy:31)
As you can see, the base URL changes causing tests to fail. What might cause this? Any ideas on where to begin looking? The in-memory database is currently set to create-drop so it should clear between unit, integration, and functional tests. DbUnit is connected in Bootstrap.groovy which starts up and tears down before and after the application is run. Any help in tracking this down is greatly appreciated.
These articles were the closest I could find to what my issue might be:
grails "test-app" fails for functional geb+spock test but "test-app -functional" is successfull