0

i'm writing tests via selenium web driver here's my code :

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>

My test class named GoogleTest.java. after reading this post : failsafe plugin won't run on one project but will run on another -- why?

I changed the name of my class so it's:

<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>

But the problem persist.

4

1 回答 1

1

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

mvn verify
于 2012-07-10T12:18:01.060 回答