The most well-known web integration testing suite around is probably Selenium, but I must say that I'm more and more happy with HtmlUnit-based tests only. Why? The big difference is that I can run all of my HtmlUnit-based tests within my IDE without extra configuration and they run an order of magnitude faster than the multi-process Selenium tests. Another major benefit is that I can directly access the embedded database and Tapestry registry and do everything within a single JVM, which is extremely useful for setting up the test fixtures and the system state before the test and then cleaning up everything afterwards. Finally, maintainability is way better. While it may take longer to write the first HtmlUnit test than recoding a Selenium test, writing the next ones and maintaining the test suite as your applications evolves is far, far easier. JMHO of course.
I just finished writing the following test for integration testing a referral system: I start up the embedded Jetty, write a new Referral entity to the database, browse the site as a (guest) user as if he was referred by the Referral, sign up via an Ajax control, receive an email sent by the system, verify the new user activation by clicking on the url in the email, fill in the user details and finally verify that the referral is credited for by doing a database query. It covers a lot of ground, but it's all executed in less than 8 seconds on my development laptop. All together 24 lines of code, most of it used for setting up the test fixtures. Now, PHP guys, let me see you do that! (Sorry that was unfair, but ah, it felt good
).
For those interested in the details, the big three libraries in play are Jetty, Hibernate and Tapestry (naturally). I'm also using a version of Tynamo's own AbstractContainerTest, Wiser (for email integration testing, note that I moved away from Dumbster) and H2 (don't I love that database!).
Selenium makes a lot of sense if you really are executing the tests against multiple browsers and your tests are mostly focused on browser compatibility. From what I've seen though, most of the time people are using Selenium with a single web driver and they are simply using it for integration testing the application workflow. HtmlUnit's browser doesn't seem to have any problem parsing the webpages I feed to it or executing the Javascript embedded on them, so in practice if my HtmlUnit-based integration test fails, I can be pretty sure the same doesn't work on any "real" browser either.
