How to build this XLT test-suite in maven?


#1

I downloaded xlt project, renamed sample/template-testsuite project and opened in eclipse. then i converted it into a maven project.

But while running mvn test, its is not creating any results.
This is what my pom.xml looks like.

Is there any more additional tags to add ?

<project 
xmlns="http://maven.apache.org/POM/4.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd">  
 <modelVersion>4.0.0</modelVersion>
 <groupId>tatcha.demandware.sitegenesis</ groupId>
 <artifactId>testsuite-mvnExample1< /artifactId>
 <version>0.0.1-SNAPSHOT< /version>
 <name>tatchaTestSuiteMavenExample1< /name>
 <description>Test Suite for Tatcha Demandware Site Genesis in Maven< /description>

<build>
<sourceDirectory>src< /sourceDirectory>

<plugins>
  <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.3</version>
    <configuration>
      <source>1.8</source>
      <target>1.8</target>
    </configuration>
  </plugin>
</plugins>
</build>

<repositories>
    <!-- Declare Xceptance repository that hosts the XLT artifacts -->
    <repository>
        <id>xceptance-releases</id>
        <url>https://lab.xceptance.de/nexus/content/repositories/releases/</url>
    </repository>
</repositories>

<dependencies>
    <!-- Declare XLT dependency -->
    <dependency>
        <groupId>com.xceptance</groupId>
        <artifactId>xlt</artifactId>
        <version>4.3.0</version>
    </dependency>
</dependencies>

< /project>

#2

Yes, there are more things to consider. First, if your test classes are not located in the default directory “src/test/java”, but in “src”, you need to tell Maven about it using the “testSourceDirectory” element.

But Surefire picks up test cases only if they follow a certain name pattern. For example, only classes that end with …Test will be executed as test cases. If you use another naming pattern for your test classes, you can configure this as well.

Last but not least, you may pass any XLT property as system variable to Surefire.

Additional recommended configuration options:

  • Always use UTF-8 as file encoding.
  • Use latest XLT version.

See below for the final version of your POM that includes all of the above modifications.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>tatcha.demandware.sitegenesis</groupId>
    <artifactId>testsuite-mvnExample1</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>tatchaTestSuiteMavenExample1</name>
    <description>Test Suite for Tatcha Demandware Site Genesis in Maven</description>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <testSourceDirectory>src</testSourceDirectory>

        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.20</version>
                <configuration>
                    <includes>
                        <include>com/company/tests/T*.java</include>
                    </includes>
                    <systemPropertyVariables>
                        <!-- Relocate the XLT results directory under target. -->
                        <com.xceptance.xlt.result-dir>${project.build.directory}/xlt-results</com.xceptance.xlt.result-dir>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <!-- Declare Xceptance repository that hosts the XLT artifacts -->
        <repository>
            <id>xceptance-releases</id>
            <url>https://lab.xceptance.de/nexus/content/repositories/releases/</url>
        </repository>
    </repositories>

    <dependencies>
        <!-- Declare XLT dependency -->
        <dependency>
            <groupId>com.xceptance</groupId>
            <artifactId>xlt</artifactId>
            <version>4.9.4</version>
        </dependency>
    </dependencies>

</project>

#3

Thanks very much Jwerner…!

It really worked :smile:


closed #4