Permalink
Fetching contributors…
Cannot retrieve contributors at this time
138 lines (118 sloc) 4.47 KB

Running the Microprofile Metrics TCK

Any Microprofile 1.2 and higher release must pass this test suite. The TCK uses junit.

Dependencies

To enable the tests in your Arquillian based test project you need to add the following dependencies:

<dependencies>
    <dependency>
        <groupId>org.eclipse.microprofile.metrics</groupId>
        <artifactId>microprofile-metrics-api</artifactId>
        <version>1.0</version>
    </dependency>

    <dependency>
        <groupId>org.eclipse.microprofile.metrics</groupId>
        <artifactId>microprofile-metrics-rest-tck</artifactId>
        <version>1.0</version>
    </dependency>

    <dependency>
        <groupId>org.eclipse.microprofile.metrics</groupId>
        <artifactId>microprofile-metrics-api-tck</artifactId>
        <version>1.0</version>
    </dependency>

    <dependency>
        <groupId>javax.enterprise</groupId>
        <artifactId>cdi-api</artifactId>
        <version>1.2</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-all</artifactId>
        <version>1.3</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.jboss.arquillian.junit</groupId>
        <artifactId>arquillian-junit-container</artifactId>
        <version>1.1.8.Final</version>
        <scope>test</scope>
    </dependency>

    <!-- You can replace this with your choice of container -->
    <dependency>
        <groupId>org.jboss.arquillian.container</groupId>
        <artifactId>arquillian-wlp-managed-8.5</artifactId>
        <version>1.0.0.Final-SNAPSHOT</version>
        <scope>test</scope>
    </dependency>
</dependencies>

Declaring the Tests to run in Apache Maven pom.xml

If you use Apache Maven, then the tests are run via the maven-surefire-plugin by adding the following in your pom.xml.

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</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.19.1</version>
            <configuration>
                <dependenciesToScan>
                    <dependency>org.eclipse.microprofile.metrics:microprofile-metrics-api-tck</dependency>
                    <dependency>org.eclipse.microprofile.metrics:microprofile-metrics-rest-tck</dependency>
                </dependenciesToScan>
                <environmentVariables>
                    <MP_METRICS_TAGS>tier=integration</MP_METRICS_TAGS>
                </environmentVariables>
            </configuration>
        </plugin>
    </plugins>
</build>

Note: Be sure to set up your Arquillian.xml as required for your server under test.

Running the TCK

To run the TCK, ensure that the above dependencies are installed, and run the following command:

# Modify the test.url variable to point to your server under test
mvn test -Dtest.url=http://localhost:9080

If your server under test has basic authentication enabled, run the following command:

# Modify the test.url variable to point to your server under test.  Modify the test.user and test.pwd variables to appropriate values for your server under test.
mvn test -Dtest.url=https://localhost:9443 -Dtest.user=someUser -Dtest.pwd=somePassword