Setting up Hudson with the Selenium Plugin

42 views
Skip to first unread message

Matt Raible

unread,
Apr 5, 2010, 5:37:19 PM4/5/10
to Selenium Users
I'm trying to get the Selenium Plugin for Hudson working so I can run
Selenium tests on IE.

Our master build server is on Solaris and I've been successful in
setting up a Windows box as a remote agent. I'm able to run all the
Selenium tests on Solaris (with Maven, Cargo and the Selenium Maven
plugin) successfully. I'm also able to run the whole build on the
Windows box, but I can't get the Selenium tests to run on Windows
only.

According to the plugin's documentation [1], I should be able to pass
in "windows:*iexplore" as the browser string and the Selenium tests
will be run on Windows. I've tried this and the first error I get is:

Cannot run program "xauth"

I'm guessing is because I have the Selenium Maven plugin configured to
work on our headless server. To fix this, I added the ability to skip
this by modifying the selenium-maven-plugin's configuration.

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
<version>1.0.1</version>
<executions>
<execution>
<id>xvfb</id>
<phase>pre-integration-test</phase>
<goals>
<goal>xvfb</goal>
</goals>
<configuration>
<display>:5</display>
<skip>${xvfb.skip}</skip>
</configuration>
</execution>
<execution>
<id>selenium</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start-server</goal>
</goals>
<configuration>
<background>true</background>
</configuration>
</execution>
</executions>
</plugin>

Then in the Hudson job, I added "xvfb.skip=true" as a property. After
making this change, running the test results in the following error:

[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: /.hudson/jobs/project-selenium-ie8xp3/
workspace/project/target/selenium/user-extensions.js
11:52:42,998 INFO [org.openqa.selenium.server.SeleniumServer] Java:
Sun Microsystems Inc. 14.2-b01
11:52:42,998 INFO [org.openqa.selenium.server.SeleniumServer] OS:
SunOS 5.10 x86
11:52:43,014 INFO [org.openqa.selenium.server.SeleniumServer] v2.0
[a2], with Core v2.0 [a2]
11:52:43,123 INFO [org.openqa.selenium.server.SeleniumServer]
RemoteWebDriver instances should connect to: http://71.74.48.194:4444/wd/hub
11:52:43,124 INFO [org.openqa.jetty.http.HttpServer] Version Jetty/
5.1.x
11:52:43,124 INFO [org.openqa.jetty.util.Container] Started
HttpContext[/selenium-server/driver,/selenium-server/driver]
11:52:43,125 INFO [org.openqa.jetty.util.Container] Started
HttpContext[/selenium-server,/selenium-server]
11:52:43,125 INFO [org.openqa.jetty.util.Container] Started
HttpContext[/,/]
11:52:43,260 INFO [org.openqa.jetty.util.Container] Started
org.openqa.jetty.jetty.servlet.ServletHandler@10dc6b5
11:52:43,261 INFO [org.openqa.jetty.util.Container] Started
HttpContext[/wd,/wd]
11:52:43,262 WARN [org.openqa.jetty.util.ThreadedServer] Failed to
start: SocketL...@0.0.0.0:4444
Exception in thread "main" java.net.BindException: Selenium is already
running on port 4444. Or some other service is.
at
org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:
399)
at
org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:
234)
at
org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:
198)

I'm guessing the Selenium Plugin doesn't need to have Selenium RC
startup, so I added the ability to skip starting that as well.

<execution>
<id>selenium</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start-server</goal>
</goals>
<configuration>
<skip>${selenium.server.skip}</skip>
<background>true</background>
</configuration>
</execution>

Then I modified the job in Hudson to pass in
"selenium.server.skip=true" as a property. At this point, my
properties for the Hudson job are as follows:

selenium.browser=windows:*iexplore
xvfb.skip=true
selenium.server.skip=true

Running the job again results in all my Selenium tests failing with
the following error:

java.lang.RuntimeException: Could not start Selenium session: ERROR:
Could not retrieve a new session
at
com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:
103)

Any ideas why this doesn't work? As I mentioned earlier, I *can* build
my project on using the Windows as an Agent (if I tie it to the node
in the job's configuration).

Thanks,

Matt

[1] http://wiki.hudson-ci.org/display/HUDSON/Selenium+Plugin

Reply all
Reply to author
Forward
0 new messages