简体   繁体   中英

maven surefire plugin - specifying a single test - does NOT run

I have this maven profile setup.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.8</version>
    <configuration>
        <includes>
            <include>com.something.test.X.java</include>
        </includes>

        <properties>
            <property>
                <name>reporter</name>
                <value>org.testng.reporters.XMLReporter</value>
            </property>
            <property>
                <name>listener</name>                          
                <value>Listener</value>
            </property>
        </properties>

        <systemProperties>
            <property>
                <name>x.host</name>
                <value>${server.ip}</value>
            </property>
            <property>
                <name>http_port</name>
                <value>${http_port}</value>
            </property>
            <property>
                <name>https_port</name>
                <value>${https_port}</value>
            </property>
            <property>
                <name>jmx_remote_port</name>
                <value>${jmx_remote_port}</value>
            </property>
        </systemProperties>

        <systemPropertyVariables>
            <x.host>${server.ip}</x.host>
            <env.BUILD_NUMBER>${env.BUILD_NUMBER}</env.BUILD_NUMBER>
            <env.HOSTNAME>${env.HOSTNAME}</env.HOSTNAME>
        </systemPropertyVariables>
    </configuration>

    <executions>
        <execution>
            <id>test</id>
            <phase>integration-test</phase>
            <goals>
                <goal>test</goal>
            </goals>
            <configuration>
                <skip>false</skip>
            </configuration>
        </execution>
    </executions>
</plugin>

When i run the profile, the test included does not run! What am i doing wrong? i even tried it with the suitexmlfile but i get a parsing error where it cannot find the class.

As Andrew Logvinov suggested, you should remove .java from the name of the test you include. In general, test coordinates are specified as <class-name>[#<method-name>] .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM