DZone
Java Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Java Zone > Testing with Embed for Vaadin

Testing with Embed for Vaadin

Nicolas Fränkel user avatar by
Nicolas Fränkel
CORE ·
Apr. 04, 12 · Java Zone · Interview
Like (0)
Save
Tweet
4.94K Views

Join the DZone community and get the full member experience.

Join For Free

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:

EmbedVaadin.forComponent(new FormAdvancedLayoutExample()).wait(false).start();

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.

EmbedVaadin.forApplication(EmbedApplication.class).wait(false).start();

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!

EmbedVaadin.forApplication(EmbedApplication.class).withHttpPort(8888).wait(true).openBrowser(true).start();

For Maven users, the good news is that the add-on is readily provided as a Maven dependency:

<dependency>
    <groupId>com.bsb.common.vaadin</groupId>
    <artifactId>com.bsb.common.vaadin.embed</artifactId>
    <version>0.1</version>
    <scope>test</scope>
</dependency>

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.

 

 

 

Vaadin

Published at DZone with permission of Nicolas Fränkel, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • 27 Free Web UI Mockup Tools
  • Modernizing Testing With Data Pipelines
  • How to Leverage Method Chaining To Add Smart Message Routing in Java
  • Pattern Matching for Switch

Comments

Java Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo