Search code examples
testinggrailshudsonjenkinsfunctional-testing

Integration testing two grails web applications at once?


I've got two grails applications, A and B.

A makes explicit REST calls to B, and I'd like an automated way of knowing this works. In the traditional grails integration-test model, only a single instance is pulled up at a time. I'm using jenkins as my build server, but it almost seems like I would need to deploy both systems and run tests locally, which I'm not sure jenkins supports.

What's the best way to do full integration functional testing of A using B?


Solution

  • This isn't unique to grails or even Jenkins, but here's what you can do.

    Set up a functional test server where you can deploy your applications. Create one Jenkins job to poll project A for SCM changes and deploy to server A, and one job to poll project B for SCM changes and deploy to server B.

    Create a downstream build, C, which runs any functional tests against the combined system. Note that you probably don't want to bootstrap either database here, so don't use the integration test phase. This where you would use something like selenium. Make sure to block both upstream builds A and B on dowstream builds, and block C on all upstream builds.

    That way, no server gets re-deployed in the middle of a test-run.

    As for integration testing, imagine B to be like any other web service, like a database or an LDAP server or anything. If you wanted a full integration test, you'd just setup a server for your test run and run against it, right? Do the same. Using your B build or another build, create an integration test job which explicitly knows about the B server.