Fork me on GitHub

Introduction

BRUT provides annotation-based testing for brXM delivery-tier components. Annotate a test class and BRUT handles the infrastructure — repository bootstrap, HST container, and request pipelines.

Quick Example


@BrxmJaxrsTest(resources = {HelloResource.class})
class MyApiTest {

    @Test
    void testEndpoint(DynamicJaxrsTest brxm) {
        brxm.request()
            .get("/site/api/hello/world")
            .assertBody("Hello, World!");
    }
}
          

No abstract classes, no lifecycle management, no boilerplate configuration.

Key Features

  • Bean packages auto-detected from project structure; override with beanPackages when needed
  • Test harness injected via @Test method parameters or field injection
  • Fluent request builder: chainable setup with typed response deserialization
  • Load real HCM modules into the test repository with loadProjectContent = true
  • Three Test Types - Components, JAX-RS APIs, and Page Model

Module Overview

Module Purpose Use For
brut-common In-memory JCR repository, YAML import, JUnit 5 extensions Shared infrastructure
brut-components HST Component testing with @BrxmComponentTest Component Tests
brut-resources JAX-RS and Page Model testing JAX-RS / Page Model

Getting Started

  1. Install Dependencies - Add BRUT to your project
  2. Quick Start - Write your first test
  3. Quick Reference - Annotation options and API reference

Testing Guides

Guide Description
JAX-RS Testing Test REST endpoints with fluent request builder
Page Model Testing Test Page Model API with JSON response parsing
Component Testing Test HST components in isolation
Test Data (YAML) Create focused test content

Patterns and Reference

Resource Description
Authentication Patterns Test authenticated users and roles
Common Patterns Mocking, assertions, naming conventions
ConfigService Repository Production-parity HST configuration
Architecture How BRUT works
Troubleshooting Common issues and fixes
Legacy API Abstract class approach (still supported)