Fork me on GitHub

Introduction

BRUT 5.1.0 introduces annotation-based testing for brXM delivery tier with 66-74% less boilerplate than legacy abstract classes. Write tests with simple annotations and let BRUT handle the infrastructure.

Quick Example


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

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

That's it! No abstract classes, no 30+ lines of configuration, no lifecycle management.

Key Features

  • Zero-Config Auto-Detection - Bean packages discovered from project structure
  • JUnit 5 Parameter Injection - Test harness injected via @Test method parameters
  • Fluent Request API - Chainable request building with typed responses
  • ConfigService Integration - Production-parity testing with one-liner setup
  • 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)