Docs

Browserless Testing

APIs, lifecycle guarantees, and framework integrations of Vaadin browserless testing.
Note
Browserless testing was previously known as UI Unit Testing and required a commercial TestBench subscription. Browserless testing is free for all users.

Browserless testing removes the need to run a browser or a servlet container, making it much faster to test your Vaadin-based applications.

With browserless testing, you look up components directly from UI.getCurrent(), bypassing the browser and the client-server communication bridge. You call methods directly on your server-side view classes and Vaadin components.

You also don’t need to launch a servlet container. The BrowserlessTest class creates the Vaadin session, the UI, and other necessary Vaadin classes directly in the JVM that runs your JUnit tests.

In addition to browserless testing, Vaadin also allows you to write end-to-end tests for your applications. Each approach has its own advantages.

Start by choosing your application framework for setup and a runnable example. The following pages describe APIs, lifecycle guarantees, and integration behavior. The Spring, Java EE/CDI, and Quarkus integrations each have their own page; the Java EE/CDI integration needs a Weld-backed test environment and a CDI servlet.

Topics

Test Environment and Lifecycle
Browserless test base classes, environment lifecycle, route scanning, navigation, and simulated server round trips.
Querying Components
Details and examples on accessing components within a browserless test.
Component Testers
Tester selection, supported actions, usability checks, constraints, and custom tester discovery.
Component Locators
Typed component locator entry points, filters, resolution caching, custom locators, and opt-in interfaces.
Testing Overlay Components
How to test context menus, menu bars, and other overlay-based components in browserless tests.
UI Snapshots
Failure snapshot extension behavior and the format of server-side component tree output.
Application, User, and Window Contexts
Browserless context ownership, thread affinity, window activation, security isolation, factories, and configuration.
Signal Test Environment
Signal propagation, background task processing, shared-signal updates, and write confirmation in browserless tests.
JUnit 6 Extensions
Composition-based browserless test setup, per-method and per-class lifecycles, and extension configuration.
Test Configuration
Set Vaadin application properties, feature flags, and Lookup services for a single test class or test method.
Spring Security Integration
Authentication timing and navigation access-control requirements for Spring browserless tests.
Spring Test Lifecycle
The order in which Spring and the browserless environment set up a test, and how it affects session-scoped beans and authentication.
CDI Test Integration
Lifecycle ordering, CDI bean discovery, scopes, servlet integration, and route registration in Weld-based browserless tests.
Quarkus Integration
Quarkus browserless test initialization, dependency injection, test profiles, and security integration.

17590340-7B0A-463B-846B-FEDB1F1AE1B3

Updated –