我正在尝试使用 Jenkins 运行测试套件并启动 Selenium Server。在作业配置中,作为构建步骤,我已包括:
当执行命令时,Jenkins 在某个点挂起并且无法继续。
+ java -jar /var/lib/selenium/selenium-server-standalone-2.44.0.jar
22:21:00.572 INFO - Launching a standalone server
22:21:00.631 INFO - Java: Oracle Corporation 24.65-b04
22:21:00.631 INFO - OS: Linux 3.13.0-36-generic amd64
22:21:00.669 INFO - v2.44.0, with Core v2.44.0. Built from revision 76d78cf
22:21:00.840 INFO - Default driver org.openqa.selenium.ie.InternetExplorerDriver registration is skipped: registration capabilities Capabilities [{platform=WINDOWS, ensureCleanSession=true, browserName=internet explorer, version=}] does not match with current platform: LINUX
22:21:00.941 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
22:21:00.942 INFO - Version Jetty/5.1.x
22:21:00.944 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
22:21:00.945 INFO - Started HttpContext[/selenium-server,/selenium-server]
22:21:00.945 INFO - Started HttpContext[/,/]
22:21:00.989 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@5b7da0d1
22:21:00.989 INFO - Started HttpContext[/wd,/wd]
22:21:00.997 INFO - Started SocketListener on 0.0.0.0:4444
22:21:00.997 INFO - Started org.openqa.jetty.jetty.Server@2ce6a73d
如果我在控制台中启动 Selenium Server,Jenkins 作业就会成功完成。
有任何想法吗?
答案1
Jenkins 按顺序执行命令。只有当前命令完成后才会转到下一个命令。
现在,您启动 Selenium 并且它在前台运行。除非您终止它,否则您执行的命令仍在运行。这就是 Jenkins 不会继续执行构建中的其他命令的原因。
您最好使用 Upstart 或其他东西来启动 Selenium,以便它始终运行。