我如何使用 Jenkins/Maven 运行 我的 selenium 测试?
How do I run my selenium tests with Jenkins/Maven?
我在本地机器 运行ning Ubuntu 上设置了 Jenkins,将其指向我的 jdk,然后 maven 为 运行 我的 Selenium 测试创建了一个作业并为它提供了项目中 pom.xml 的路径,但是当我尝试 运行 作业时,它立即失败了。控制台输出为
Building in workspace /var/lib/jenkins/workspace/new job
[new job] $ /usr/share/maven2/bin/mvn -f /pathto/pom.xml -Dtests=firefox_tests.xml -Dreceiver=myemail@myemail.com...You must specify at least one goal or lifecycle phase to perform build steps. The following list illustrates some commonly used build commands:
mvn clean Deletes any build output (e.g. class files or JARs).mvn test...
我只是不确定如何进行。我怎样才能克服这个错误并使用 Jenkins 和 Maven 使我的 Selenium 测试达到 运行?谢谢
根据您的错误和输出,您运行将其设置为:
mvn -f /pathto/pom.xml -Dtests=firefox_tests.xml -Dreceiver=myemail@myemail.com
所以,这里没有建立什么目标。您如何 运行 手动设置它?可能忘记 运行 为 "mvn test -f ..." ?
您是否已将 selenium 测试挂接到 Maven 生命周期中?
通常 selenium 测试将作为集成测试阶段的一部分执行,可以在 pom.xml
中使用如下插件配置进行配置
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<skip>${skip.selenium.tests}</skip>
<parallel>none</parallel>
<threadCount>1</threadCount>
<reuseForks>false</reuseForks>
<disableXmlReport>true</disableXmlReport>
</configuration>
<executions>
<execution>
<id>runSeleniumTests</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
</plugin>
将此添加到您的 pom(以及所有 Selenium 依赖项)后,您应该能够 运行 使用
进行 selenium 测试
mvn clean integration-test
这也是您应该在 CI 服务器中指定的命令。
或者,如果它只是询问您要执行的目标,请选择:'clean integration-test'
我在本地机器 运行ning Ubuntu 上设置了 Jenkins,将其指向我的 jdk,然后 maven 为 运行 我的 Selenium 测试创建了一个作业并为它提供了项目中 pom.xml 的路径,但是当我尝试 运行 作业时,它立即失败了。控制台输出为
Building in workspace /var/lib/jenkins/workspace/new job [new job] $ /usr/share/maven2/bin/mvn -f /pathto/pom.xml -Dtests=firefox_tests.xml -Dreceiver=myemail@myemail.com...You must specify at least one goal or lifecycle phase to perform build steps. The following list illustrates some commonly used build commands: mvn clean Deletes any build output (e.g. class files or JARs).mvn test...
我只是不确定如何进行。我怎样才能克服这个错误并使用 Jenkins 和 Maven 使我的 Selenium 测试达到 运行?谢谢
根据您的错误和输出,您运行将其设置为:
mvn -f /pathto/pom.xml -Dtests=firefox_tests.xml -Dreceiver=myemail@myemail.com
所以,这里没有建立什么目标。您如何 运行 手动设置它?可能忘记 运行 为 "mvn test -f ..." ?
您是否已将 selenium 测试挂接到 Maven 生命周期中?
通常 selenium 测试将作为集成测试阶段的一部分执行,可以在 pom.xml
中使用如下插件配置进行配置<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<skip>${skip.selenium.tests}</skip>
<parallel>none</parallel>
<threadCount>1</threadCount>
<reuseForks>false</reuseForks>
<disableXmlReport>true</disableXmlReport>
</configuration>
<executions>
<execution>
<id>runSeleniumTests</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
</plugin>
将此添加到您的 pom(以及所有 Selenium 依赖项)后,您应该能够 运行 使用
进行 selenium 测试mvn clean integration-test
这也是您应该在 CI 服务器中指定的命令。 或者,如果它只是询问您要执行的目标,请选择:'clean integration-test'