Testing with Embed for VaadinSubmitted on 31 March 2012
In order to execute integration tests of a web application, there are not so many tools available. One of such tools is JBoss Arquilian: it let you create an archive of your to-be-tested Java classes. Embed Vaadin does the same, but is specifically targeted at Vaadin applications and components!
Just select the component you want to test, and presto, it’s wrapped in a dummy application and launched in an embedded Tomcat:
If you need to go beyond that and test the full application, that’s also possible. The library takes care of instantiating the application class and all the underlying gory details.
Of course, there are configuration parameters. For example, you can choose the HTTP port (in order to avoid port conflict) and to launch a browser window. Presto, your integration test is ready to run!
For Maven users, the good news is that the add-on is readily provided as a Maven dependency:
For Vaadin 7, please use:
For those wishing to go further, a full-fledged example is available on Github.
Note that Embed Vaadin is available under the friendly Apache 2.0 license.