gpt4 book ai didi

testing - 使用 Maven 运行单个测试

转载 作者:行者123 更新时间:2023-11-28 20:57:12 25 4
gpt4 key购买 nike

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

联机 联机 4.8.1 测试 org.seleniumhq.selenium.client-驱动程序 selenium-java-客户端驱动程序 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>

WebTest自动化 org.apache.maven.插件 maven-war-插件 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.插件 maven-surefire-插件 2.4.3 org.junit:com.springsource.org.junit **/功能/*测试.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>

错误的 没有任何 **/功能/*测试.java

</project>

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

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

最佳答案

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

关于testing - 使用 Maven 运行单个测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11395406/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com