1

我想使用 maven 运行一个测试,这是我的 pom.xml :

junit junit 4.8.1 测试 org.seleniumhq.selenium.client-drivers selenium-java-client-driver 1.0.2

        <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>3.0-alpha-1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
        <version>2.2.1-b03</version>
        <scope>provided</scope>
    </dependency>

WebTestAutomatisation org.apache.maven.plugins maven-war-plugin 2.0.2

     <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>tomcat-maven-plugin</artifactId>
    <version>1.0-beta-1</version>
  </plugin>



     <!--  Start the tomcat server and  Deploy the war -->
    <plugin>
      <groupId>org.codehaus.cargo</groupId>
      <artifactId>cargo-maven2-plugin</artifactId>
      <version>1.2.2</version>
        <configuration>

    <fork>true</fork>
        <wait>false</wait>
            <container>
 <containerId>tomcat7x</containerId>
 <type>installed</type>
  <home>${env.CATALINA_HOME}</home>
   </container>
  <!-- <executions>
  <execution>
 <id>start-container</id>
  <phase>pre-integration-test</phase>
  <goals>
  <goal>start</goal>
   <goal>deploy</goal>
  </goals>
 </execution>
 <execution>
  <id>stop-container</id>
 <phase>post-integration-test</phase>
  <goals>
   <goal>stop</goal>
  </goals>
 </execution>
 </executions> -->
</configuration>

 <!-- Start the selenium server -->
 <plugin>
  <groupId>org.codehaus.mojo</groupId>
 <artifactId>selenium-maven-plugin</artifactId>
 <version>2.3</version>

  <executions>
     <execution>
      <id>start</id>
    <phase>pre-integration-test</phase>
  <goals>
   <goal>start-server</goal>
   </goals>
  <configuration>
   <background>true</background>
   <logOutput>true</logOutput>
  </configuration>
 </execution>
 <execution>

停止集成测试后停止服务器
org.apache.maven.plugins maven-surefire-plugin 2.4.3 org.junit:com.springsource.org.junit **/functional/*Test.java

 <!--   Running the tests in the functional tests package
      during the integration tests phase. -->
 <id>integration-tests</id>
 <phase>integration-test</phase>
  <goals>
<goal>test</goal>

false 无 **/functional/*Test.java

</project>

我使用了这个命令:mvn -Dtest=MyTestClass test 我得到了这个错误:

我试过这个命令,但它运行所有测试而不是指定的 mvn -Dit.test=MyTestClass verify

4

1 回答 1

0

Jute maven 插件允许将单个 JUnit 测试作为外部 JVM 进程执行

于 2015-05-18T10:41:57.247 回答