简体   繁体   English

maven surefire插件-指定单个测试-无法运行

[英]maven surefire plugin - specifying a single test - does NOT run

I have this maven profile setup. 我有这个Maven个人资料设置。

<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. 我什至用suitexmlfile尝试了它,但遇到无法找到该类的解析错误。

As Andrew Logvinov suggested, you should remove .java from the name of the test you include. 正如Andrew Logvinov建议的那样,您应该从所包含的测试名称中删除.java In general, test coordinates are specified as <class-name>[#<method-name>] . 通常,将测试坐标指定为<class-name>[#<method-name>]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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