Test Development
Author, debug, and stabilize XLT load testing scenarios locally using JUnit and your IDE.
Overview
XLT test cases are standard JUnit tests written in Java. You can author, execute, and debug them locally in any Java IDE (such as IntelliJ IDEA, Eclipse, or VS Code).
Typical test suites are structured as standard Maven projects. You can start from scratch or clone one of the official Sample Test Suites to adapt existing patterns to your application under test.
Core Abstractions: Actions and Flows
When designing test cases, model realistic user journeys (such as landing on the homepage, searching the catalog, viewing items, and checking out). To keep code maintainable and modular, XLT separates test steps into Actions and Flows:
| Abstraction | Scope | Role | Example |
|---|---|---|---|
| Action | Single user interaction | Issues one or more HTTP requests, measures response times, and validates the response. | AddToCart, PlaceOrder |
| Flow | Multi-action sequence | Groups cohesive actions into a reusable business transaction across multiple test cases. | BrowsingFlow, CheckoutFlow |
Sample Flow & Action Structure
Homepage
--------------------------------------------
GoToSignIn
--------------------------------------------
Register
--------------------------------------------
Login
--------------------------------------------
BrowsingFlow: SelectTopCategory
SelectCategory
Paging
ProductDetailView
--------------------------------------------
Search
--------------------------------------------
AddToCart
--------------------------------------------
CheckoutFlow: StartCheckout
EnterShippingAddress
EnterBillingAddress
EnterPaymentMethod
--------------------------------------------
PlaceOrder
--------------------------------------------
Logout
Composing Test Scenarios
By assembling flows and actions, you can create diverse test scenarios with minimal duplicate code:
- Browse Only:
Homepage→BrowsingFlow - Catalog Search:
Homepage→Search - Abandoned Cart:
Homepage→BrowsingFlow→AddToCart→CheckoutFlow - Guest Checkout:
Homepage→BrowsingFlow→AddToCart→CheckoutFlow→PlaceOrder - Registered Order:
Homepage→Login→BrowsingFlow→AddToCart→CheckoutFlow→PlaceOrder→Logout
Local Execution and Stabilization
Stabilize test cases locally before running them in a load generation cluster. Flaky tests produce functional errors during load testing, which distorts performance metrics.
Managing Randomness
Realistic load tests require variance. Instead of always requesting identical categories or products, introduce random choices from predefined pools using XltRandom:
int categoryIndex = XltRandom.nextInt(categories.size());
Deterministic Replay for Debugging
When a randomized test run fails, you can replay the exact same sequence. Each test run logs an initial random seed. Set this seed in dev.properties to reproduce the failure:
# dev.properties
com.xceptance.xlt.random.initValue = 1592316571344
You can find the initial seed at the end of the test console output and on the Result Browser overview page.


Analyzing Errors with the Result Browser
The Result Browser captures complete HTTP traffic, request headers, response bodies, and screenshots for each executed action. When a test fails:
- Locate the Result Browser link printed in the console output.
- Inspect the failed action and examine the server response status and body.
- Review the preceding actions to verify that application state was established correctly.
Continuous Integration
Because XLT scenarios run as standard JUnit tests, you can integrate them into any CI/CD pipeline (such as GitHub Actions, Jenkins, or Bamboo).
- Maven Execution: Execute test suites via
mvn testin headless environments. - Jenkins Integration: Use the XLT Jenkins Plugin to track performance trends and evaluate pass/fail criteria automatically across builds.
Data-Driven Testing
Separate test logic from test data. XLT automatically loads external test parameters from properties files stored in config/data/.
Property File Resolution
XLT maps test case names to property files:
- Test case
TAuthorloadsconfig/data/TAuthor.properties. - Fully qualified names like
com.company.test.TAuthormap toconfig/data/TAuthor.propertiesby default.
Multi-Dataset Configuration
To run the same test case against multiple user accounts or data variants, define keyed datasets within the same file:
# config/data/TOrder.properties
dataset1.customer.id = 1001
dataset1.customer.password = secret1
dataset2.customer.id = 1002
dataset2.customer.password = secret2
XLT automatically discovers all defined dataset keys and executes the scenario for each set. If no prefix is present, the test executes once with global properties.
Best Practices
Follow these authoring guidelines to ensure stable, maintainable test suites:
- Keep Test Cases Focused: Cover a single business transaction per test case. Short, isolated tests are easier to debug and simplify root-cause analysis when failures occur.
- Avoid Redundant Navigation: Navigate directly to target pages whenever possible. For example, when testing checkout, start directly on a product page rather than navigating through search in every test. If search breaks, only search tests fail.
- Encapsulate Reusable Logic in Flows: Extract repetitive sequences (such as authentication or checkout steps) into flows. When UI elements change, update the locator in one flow rather than across dozens of test cases.
- Maintain Execution Consistency: Use established flows consistently across all scenarios. Avoid mixing ad-hoc action calls with standardized flows.
- Clean Up Test Data: Ensure scenarios delete created items, addresses, or carts before exiting. Tests must start and finish in a clean, predictable state.
- Plan for Concurrent Collisions: When multiple virtual users run concurrently, avoid hardcoded account names or single-use promo codes. Use unique IDs or randomized credentials to prevent constraint violations.
- Use Resilient Locators:
Prefer element IDs (
//div[@id='cart']) over fragile absolute paths (/html/body/div[3]/div[2]/...). Relative locators withstand UI layout changes across application releases.