Home

Awesome

Karibu Testing example with Vaadin and Spring Boot

This project demonstrates the possibility to test your Vaadin Spring apps with Karibu Testing.

The example contains a view that submits T-shirt orders. The UI is similar to what you might have seen in Vaadin expo booth.

<img src="https://raw.githubusercontent.com/vaadin/tshirt-shop-example/master/t-shirt-shop.png" alt="T-shirt Shop" title="T-shirt Shop" width="50%">

In addition this version submits the orders to a JPA backend, validates the data automatically based on JSR-303 annotations in the domain object and also contains a view to list current submissions.

Requires JDK 11+.

Clone and run the app

You can use it as a basis for your Vaadin experiments. To play around with the example, check it out using git or download the zip. Import it to your favorite IDE and execute the Application class or start the app from command line using:

git clone https://github.com/mvysny/t-shirt-shop-example
cd t-shirt-shop-example
mvn spring-boot:run

The application opens to http://localhost:8080

To run the tests, simply run

mvn clean test

The test will boot up the app and configure Karibu-Testing Spring integration properly, so that mocked Vaadin works with Spring properly. See the ApplicationTest.java class for more details.

Where to go from here?

Visit Karibu-Testing for full documentation on Vaadin Unit testing.

There is a tutorial about Creating CRUD UI with Vaadin at https://spring.io/guides/gs/crud-with-vaadin/ and for more complete Vaadin examples, visit http://vaadin.com/start