> Markdown version of [Quarkus Integration](https://vaadin.com/docs/next/flow/testing/browserless/quarkus). Section index: [llms.txt](https://vaadin.com/docs/next/flow/llms.txt)

# Quarkus Integration

`QuarkusBrowserlessApplicationContext` creates an application context that uses Quarkus-specific instantiation for dependency injection into views, in a `@QuarkusTest` class. The `QuarkusBrowserlessTest` base class provides the same integration for a single user and window. Tests run in a mocked Vaadin environment even though `@QuarkusTest` also starts the application and HTTP server.

## <a id="test-profiles"></a>Test Profiles

`@TestProfile` selects a `QuarkusTestProfile` that can override configuration, enable alternative beans, and supply test resources.

## <a id="navigation-access-control"></a>Navigation Access Control

The Quarkus integration requires explicit registration of `NavigationAccessControl` as a UI `BeforeEnterListener`. A service-init observer can register it for the mocked service. Restricting that observer to `MockQuarkusServletService` avoids applying test-only setup to the application also started by `@QuarkusTest`.

## <a id="security-integration"></a>Security Integration

When Quarkus Security is active, `QuarkusBrowserlessApplicationContext.createSecured()` returns a context whose `newUser()` overloads set the `SecurityIdentity` of each user: `newUser()` for an anonymous identity, `newUser(String username, String…​ roles)` for an authenticated one, and `newUser(SecurityIdentity)` for a custom identity. The identity is in place before the user’s windows are created and navigate, and the context maintains each user’s identity separately.

`QuarkusBrowserlessTest` obtains the authentication of its user from `SecurityIdentity` before UI creation and initial navigation. `@TestSecurity` supplies test-method authentication for it and requires the Quarkus Security test dependency:

```xml
<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-test-security</artifactId>
    <scope>test</scope>
</dependency>
```

`61B2F8E5-448E-4C36-82E3-D492712ECE67`
