Browserless Testing
Browserless tests exercise Flow views and components in the test JVM, without a browser or a servlet container. Choose the setup that matches your application’s dependency injection framework before writing a test.
Choose Your Framework
Application | Setup Guide | Test Base Class |
Spring Boot |
| |
Plain Java without a dependency injection container |
| |
Quarkus |
| |
Java EE / Jakarta EE with Vaadin CDI |
|
Quarkus has its own integration, even though it also uses CDI.
The Java EE/CDI guide uses the jakarta.* packages of current Vaadin applications.
Use the Examples with Your Framework
The methods that tests use to interact with the UI, such as navigate(), find(), and test(), work the same in every setup.
The setup around them differs, so each test class keeps the base class, dependencies, and configuration from its framework’s setup guide.
Most examples in the other guides use the plain Java setup. To use an example with another framework, change the base class and keep the rest of your setup:
-
Spring Boot: extend
SpringBrowserlessTestand annotate the class with@SpringBootTest. Spring beans, Spring test configuration, and Spring Security test annotations apply. -
Quarkus: extend
QuarkusBrowserlessTestand annotate the class with@QuarkusTest. Quarkus test profiles and@TestSecurityapply. -
Java EE/CDI: extend
AbstractCdiViewTest, add the tested view and its beans to its Weld archive, and register the view’s route in its setup method.
Guides
- Set Up Browserless Tests with Spring Boot
- Set up a Spring Boot project, write a browserless test for a Flow view, and run it from your IDE or Maven.
- Set Up Browserless Tests in Plain Java
- Configure browserless tests in a plain Java project using a base class or a JUnit extension.
- Set Up Browserless Tests with Quarkus
- Configure Quarkus browserless tests, create a test class, and substitute services using test profiles.
- Set Up Browserless Tests with Java EE/CDI
- Use Weld and Vaadin CDI to inject dependencies into browserless view tests, select test alternatives, and manage the test lifecycle.
- Test User Interactions
- Learn how a browserless test works, then fill in forms, select Grid rows, confirm dialogs, and test navigation, shortcuts, and menus.
- Debug a Failing Browserless Test
- Read the component tree of a failing browserless test, enable failure snapshots, and fix the test.
- Test View Access Control
- Verify anonymous, authorized, and unauthorized navigation in Spring and Quarkus browserless tests.
- Test a Custom Component
- Test a component without a route, add a reusable component tester, and encapsulate interactions in a custom locator.
- Test Signal-Based Views
- Assert changes to signal bindings, process background updates, and verify shared-signal write confirmation.
- Test Multiple Users and Windows
- Verify shared state, independent windows, and authentication isolation across several browserless user sessions.
- Configure a Browserless Test
- Set Vaadin properties and feature flags for individual browserless tests while retaining the correct framework setup.
- Speed Up Browserless Tests
- Reduce scanning and Spring context startup costs, and evaluate shared test environments without losing test isolation.
- Migrate UI Unit Tests to Browserless Tests
- Update UI Unit Testing dependencies and base classes, handle Spring support, and migrate existing JUnit tests.
E6858195-4B1D-43C8-8688-502531C6AC16