Skip to content
Docs
Esc
↑↓navigate↵open⌘Jpreview
On this page

Maven

Learn how to build and run XLT test suites using Maven.

Integrating XLT into a Maven project

XLT is published to Maven Central. This facilitates updating the XLT version used in test projects. To integrate XLT into your Maven project, copy and paste the following into your pom.xml file:

<dependencies>
    <dependency>
        <groupId>com.xceptance</groupId>
        <artifactId>xlt</artifactId>
        <version>10.0.0-beta-5</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

Copying Maven Dependencies

If your test suite uses external dependencies or libraries, they must be copied into the test suite as part of the compile or package step. XLT does not build the project on the agent machines and, therefore, does not resolve dependencies there. It simply uploads the test suite to the agent, including the contents of the target directory.

To automatically copy all non-provided dependencies to target/dependency at compile time, add the following snippet to your pom.xml:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
                <execution>
                    <id>copy-dependencies</id>
                    <phase>compile</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                    <configuration>
                        <excludeScope>provided</excludeScope>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

This ensures that all dependencies are present when the test suite is uploaded to the agent machines.

Maven Build Steps

If you run a load test for your Maven test suite in XTC, the following build steps will be executed:

mvn process-classes process-test-classes dependency:copy-dependencies -DexcludeScope=provided

We recommend running the same steps on your local machine to check if your test suite builds correctly and all necessary dependencies are copied into the target directory.

Last updated on