【问题标题】:maven-failsafe-plugin not seeing my tests (seleniumHQ)maven-failsafe-plugin 没有看到我的测试(seleniumHQ)
【发布时间】:2012-07-10 11:12:19
【问题描述】:

我正在通过 selenium Web 驱动程序编写测试,这是我的代码:

Pom.xml

<project>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.1</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>2.24.1</version>
        </dependency>
    </dependencies>

    <build>
        <finalName>SeleniumebDriverProject</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.11</version>
                <configuration>
                    <!-- Skip the normal tests, we'll run them in the integration-test phase-->
                    <skip>false</skip> 
                </configuration>
                <executions>
                    <execution>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <skip>false</skip>
                            <includes>
                                <include>**/*Test.java</include>
                            </includes>
                        </configuration>
                    </execution> 
                </executions>
            </plugin>
        </plugins> 
    </build>
</project>

我的测试类名为 GoogleTest.java。 看完这篇文章后:failsafe plugin won't run on one project but will run on another -- why?

我改了班级的名字,所以它是:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.11</version>
    <configuration>
        <!-- Skip the normal tests, we'll run them in the integration-test phase-->
        <skip>false</skip> 
    </configuration>

    <executions>
        <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
        </execution>
    <executions>
</plugin>

但问题仍然存在。

【问题讨论】:

    标签: maven selenium maven-failsafe-plugin


    【解决方案1】:

    maven-failsafe-plugin 的目标被命名为 integration-test 而不是 test。此外,如果您将命名约定更改为 maven-failsafe-plugin 的约定,那么您不需要任何包含 etc. 文件的配置。只需使用默认值。 此外,我假设您已经通过以下方式开始运行集成测试:

    mvn verify
    

    【讨论】:

    • 我尝试了默认配置,它工作正常,但是当我尝试使用另一个时,代码如下: integration-testtestfalse**/*IT.java执行>
    • 我尝试使用 mvn verify 和 mvn integration-test 对其进行测试,但出现错误:[错误] 在插件 org.apache.maven.plugins:maven- 中找不到目标“测试” failsafe-plugin:2.11 在可用目标中验证、帮助、集成测试-> [帮助 1]
    • 正如我在回答中所写,您需要将配置 test 更改为 integration-test
    猜你喜欢
    • 1970-01-01
    • 2012-02-11
    • 2019-05-08
    • 1970-01-01
    • 1970-01-01
    • 2011-12-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多