在阅读了它在“具有类似头衔的问题”下建议的所有职位(我将在派出这一职位后继续阅读)和阅读
- centripetal.ca/blog/2011/02/07/getting-started-with-selenium-and-jenkins/
- oliverpolden.com/content/setting-automated-selenium-testing-jenkinshudson
以及其他一些员额(我注意到这两个员额,因为我认为这些员额可能对某人有用) 我没有找到我所需要的答案。 我现在谈谈:
I m在一家公司工作,该公司使用Jenkins for CI和maven。 他们有三类电.检测:黄麻、陶瓷和 se。 原告可以进行陪审员测试。 现在他们决定使用Jenkins进行其他两种类型的测试(Cactus和Selenium)。 这也是我的任务。 事实将是我后来问的另一个问题(现在我一直禁止我与他站在一起太久)。 Sel测试在java书写,并且有一只java文档,所有测试如下:
package com.mycompany.test.dailySanity;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({
Test1.class,
Test2.class,
Test3.class,
})
public class AllTests {
/**
* This is just a place holder.
* Add All your TestClass one to the list above.
* NOTE, the TestClasses should be "," separated
*/
}
我收集的所有信息都发现了关于“html”诉讼的谈话,但没有发现关于这些试验是否在 j(没有,将其出口到超文本不是选择)。 我受审
export DISPLAY=":99" && java -jar /path/to/selenium-server.jar -browserSessionReuse -htmlSuite *firefox http://localhost /path/to/my/testsfile/AllTests.java /path/to/my/logfile/SeleniumLog.html
as an "Execute Shell" in "Build" step in Jenkins job, but it just stays trying something. Console output
09:29:48.508 INFO - Java: Sun Microsystems Inc. 14.2-b01
09:29:48.518 INFO - OS: Linux 2.6.18.8-xenU amd64
09:29:48.654 INFO - v2.4.0, with Core v2.4.0. Built from revision 13337
09:29:49.263 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
09:29:49.264 INFO - Version Jetty/5.1.x
09:29:49.269 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
09:29:49.271 INFO - Started HttpContext[/selenium-server,/selenium-server]
09:29:49.271 INFO - Started HttpContext[/,/]
09:29:49.337 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@7a187814
09:29:49.337 INFO - Started HttpContext[/wd,/wd]
09:29:49.343 INFO - Started SocketListener on 0.0.0.0:4444
09:29:49.343 INFO - Started org.openqa.jetty.jetty.Server@67ad77a7
10:51:00.038 INFO - Shutting down...
10:51:00.040 INFO - Stopping Acceptor ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=4444]
我假定,它没有任何其他东西(在铺设之前等待了2小时)用它作为 j,它需要一份html的档案(-htmlappe是一个cl)。
总而言之:我需要一种途径,在 Java进行Selenium测试,并在对Jenkins提起的java诉讼中进行包装。
EDITING Ok, I m not getting anywhere and running out of time. I m adding more information just in case someone can give me a hand (not that I m not thankful to Ross). Here goes my selenium_pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>my.company</groupId>
<artifactId>selenium-test</artifactId>
<version>0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium.client-drivers</groupId>
<artifactId>selenium-java-client-driver</artifactId>
<version>1.0.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>pre-integration-test</phase>
<goals>
<goal>start-server</goal>
</goals>
<configuration>
<background>true</background>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- Skip the normal tests, we ll run them in the integration-test phase -->
<skip>true</skip>
</configuration>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
<includes>
<include>/path/to/my/tests/AllTests.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
一. 导言
mvn -f selenium_pom.xml integration-test
我获得以下产出:
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.kana.sem:selenium-test:jar:0.1-SNAPSHOT
[WARNING] build.plugins.plugin.version for org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 44, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building selenium-test 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ selenium-test ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /path/to/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ selenium-test ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ selenium-test ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /path/to/resources/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ selenium-test ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.7.2:test (default-test) @ selenium-test ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ selenium-test ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO]
[INFO] --- selenium-maven-plugin:2.1:start-server (default) @ selenium-test ---
Launching Selenium Server
Waiting for Selenium Server...
[WARNING] OS appears to be Unix and no DISPLAY environment variable has been detected. Browser maybe unable to function correctly. Consider using the selenium:xvfb goal to enable headless operation.
[INFO] User extensions: /localhome/kana/p4/dev/BOT/target/selenium/user-extensions.js
08:05:07,166 INFO [org.openqa.selenium.server.SeleniumServer] Java: IBM Corporation 2.3
08:05:07,173 INFO [org.openqa.selenium.server.SeleniumServer] OS: Linux 2.6.18.8-xenU x86
08:05:07,184 INFO [org.openqa.selenium.server.SeleniumServer] v2.9.0, with Core v2.9.0. Built from revision 14289
08:05:07,273 INFO [org.openqa.selenium.server.SeleniumServer] RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
08:05:07,277 INFO [org.openqa.jetty.http.HttpServer] Version Jetty/5.1.x
08:05:07,686 INFO [org.openqa.jetty.util.Container] Started org.openqa.jetty.jetty.servlet.ServletHandler@51fe51fe
08:05:07,687 INFO [org.openqa.jetty.util.Container] Started HttpContext[/wd,/wd]
08:05:07,687 INFO [org.openqa.jetty.util.Container] Started HttpContext[/,/]
08:05:07,688 INFO [org.openqa.jetty.util.Container] Started HttpContext[/selenium-server,/selenium-server]
08:05:07,689 INFO [org.openqa.jetty.util.Container] Started HttpContext[/selenium-server/driver,/selenium-server/driver]
08:05:07,705 INFO [org.openqa.jetty.http.SocketListener] Started SocketListener on 0.0.0.0:4444
08:05:07,705 INFO [org.openqa.jetty.util.Container] Started org.openqa.jetty.jetty.Server@40e640e6
08:05:07.916 INFO - Checking Resource aliases
Selenium Server started
[INFO]
[INFO] --- maven-surefire-plugin:2.7.2:test (default) @ selenium-test ---
[INFO] No tests to run.
[INFO] Surefire report directory: /path/to/surefire-reports/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
There are no tests to run.
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 30.387s
[INFO] Finished at: Fri Jan 13 08:05:08 CST 2012
[INFO] Final Memory: 12M/30M
[INFO] ------------------------------------------------------------------------
I m Use perforce, Jenkins, maven3 and Red Hat Enterprises Franklin release 5.5 (Tikanga). 我确信我的om是问题之一,但从互联网样本中去。
感谢(并祝贺所有完成这一职务的人!)
PS: If you also know how to get a report from the Selenium tests that would be great.