Headless X11 with Xvfb (for running selenium tests without the browser popping up)

Catalin Hritcu catalin.hritcu at gmail.com
Mon Jun 25 19:58:40 CEST 2007


Hi Vincent,

On 6/25/07, Vincent Massol <vincent at massol.net> wrote:
> Hi catalin,
>
> I've checked and yes the selenium plugin we're using is too old. That
> xvfb support has been added recently. Actually the selenium plugin
> has been completely rewritten recently (it was in java it's now in
> groovy... first time I see a maven plugin in groovy). BTW it now
> supports running HTML selenium tests.
>
Is there a new version of the plugin available? If not could you
please update the snapshot we are using? I would really like to try
using xvfb on my own machine at least ... it should be very easy once
using a newer version of the selenium plugin. I would like to give it
a try.

> I've set up our CI with Raffaello on http://teamcity.xwiki.org and
>
I tried it out now. It works nicely. I can even inspect the logs and
try to see what went wrong with the the selenium tests. For example
now it's pretty clear that the problems are not caused by X but by
Firefox not being on the PATH :)

[18:19:35]: [INFO] java.lang.RuntimeException: Firefox couldn't be
found in the path!
[18:19:35]: [INFO] Please add the directory containing 'firefox-bin'
to your PATH environment
[18:19:35]: [INFO] variable, or explicitly specify a path to Firefox like this:
[18:19:35]: [INFO] *firefox /blah/blah/firefox-bin

> I've discussed the need for an X display. Raffaello is setting up a
> vncserver which will act as an X server. He prefers this over xvfb as
> he's more experienced with it and knows it works for sure. I guess we
> could do the same locally if we wanted. I think the steps are:
>
> 1- set up the DISPLAY env variable
> 2- start vncserver
> 3- start the selenium RC server
> 4- launch the browser
> 5- execute the tests
>
> I guess we could integrate steps 1 and 2 in the m2 build in a profile.
>
Well, I would personally still prefer xvfb. For one it comes with the
X server (which means it's present on about every UNIX machine, on the
Mac it needs the X server installed ... but that's still on the MacOSX
installation CD and does not require third-party software). I'm still
trying to find a vnc server for the mac ... suggestions welcome.

Second, the support for xvfb is built into the selenium maven plugin
(latest version), so it should be really easy to set up -- regardless
of ones abilities or experience. I would really like to try if this is
so. Promise I won't waste much time on this if it turns out to be hard
to do.

> Of course I think the best solution is http://www.realityqa.com/
> realityview.jsp (which I'm working on getting - I've asked Patrick if
> it's ready to be used) but this vncserver solution would be a nice
> backup solution in case the realityqa server is down or in offline mode.
>
> WDYT?
>
Can I please give this xvfb a try on my own machine? All I need is an
updated selenium plugin for maven :)

Regards,
Catalin


> On Jun 23, 2007, at 12:30 PM, Catalin Hritcu wrote:
>
> > Hi Vincent,
> >
> > I was not able to run the tests in headless mode, because I'm getting
> > a strange error. When you have some time maybe you can have a look.
> >
> > So what I did was modify Step 3 in the
> > xwiki-product-enterprise/distribution-test/pom.xml as documented here:
> > http://mojo.codehaus.org/selenium-maven-plugin/examples/headless-
> > with-xvfb.html
> > Now that part looks like this:
> >
> >      <!-- Step 3: Start Selenium -->
> >      <plugin>
> >        <groupId>org.codehaus.mojo</groupId>
> >        <artifactId>selenium-maven-plugin</artifactId>
> >        <version>1.0-beta-2-SNAPSHOT</version>
> >        <executions>
> >          <execution>
> >            <id>xvfb</id>
> >            <phase>pre-integration-test</phase>
> >            <goals>
> >              <goal>xvfb</goal>
> >            </goals>
> >          </execution>
> >          <execution>
> >            <id>start-selenium</id>
> >            <phase>pre-integration-test</phase>
> >            <goals>
> >              <goal>start-server</goal>
> >            </goals>
> >            <configuration>
> >              <background>true</background>
> >            </configuration>
> >          </execution>
> >        </executions>
> >        <configuration>
> >          <background>true</background>
> >          <multiWindow>true</multiWindow>
> >        </configuration>
> >      </plugin>
> >
> >
> > The error I get is as follows:
> > catalin-4:~/JavaApps/xwiki-trunks-devs/xwiki-product-enterprise/
> > distribution-test
> > hritcu$ mvn install
> > [INFO] Scanning for projects...
> > [INFO]
> > ----------------------------------------------------------------------
> > ------
> > [INFO] Building XWiki Products - Enterprise - Functional Tests
> > [INFO]    task-segment: [install]
> > [INFO]
> > ----------------------------------------------------------------------
> > ------
> > [INFO]
> > ----------------------------------------------------------------------
> > --
> > [ERROR] BUILD ERROR
> > [INFO]
> > ----------------------------------------------------------------------
> > --
> > [INFO] Failed to construct build plan for:
> > com.xpn.xwiki.products:xwiki-enterprise-test:pom:1.1-SNAPSHOT (
> > task-segment: [install] ). Reason: Mojo: xvfb does not exist in
> > plugin: org.codehaus.mojo:selenium-maven-plugin:1.0-beta-2-SNAPSHOT.
> > [INFO]
> > ----------------------------------------------------------------------
> > --
> > [INFO] For more information, run Maven with the -e switch
> > [INFO]
> > ----------------------------------------------------------------------
> > --
> > [INFO] Total time: 1 second
> > [INFO] Finished at: Sat Jun 23 12:22:06 CEST 2007
> > [INFO] Final Memory: 6M/11M
> > [INFO]
> > ----------------------------------------------------------------------
> > --
> > [INFO]
> > ----------------------------------------------------------------------
> > --
> > [INFO] BUILD SUCCESSFUL
> > [INFO]
> > ----------------------------------------------------------------------
> > --
> > [INFO] Total time: 1 second
> > [INFO] Finished at: Sat Jun 23 12:22:06 CEST 2007
> > [INFO] Final Memory: 6M/11M
> > [INFO]
> > ----------------------------------------------------------------------
> > --
> > catalin-4:~/JavaApps/xwiki-trunks-devs/xwiki-product-enterprise/
> > distribution-test
> > hritcu$
> >
> >
> > However the documentation says this mojo exists
> > http://mojo.codehaus.org/selenium-maven-plugin/xvfb-mojo.html
> > So this is really strange for me.
> >
> > I tried deleting the selenium-maven-plugin from the local repository
> > and the usual stuff but without any result. It gets downloaded again
> > from the XWiki(!) repository:
> >
> > [INFO] snapshot
> > org.codehaus.mojo:selenium-maven-plugin:1.0-beta-2-SNAPSHOT: checking
> > for updates from xwiki.plugin.snapshot
> > [INFO] snapshot
> > org.codehaus.mojo:selenium-maven-plugin:1.0-beta-2-SNAPSHOT: checking
> > for updates from xwiki.plugins
> > [INFO] snapshot
> > org.codehaus.mojo:selenium-maven-plugin:1.0-beta-2-SNAPSHOT: checking
> > for updates from xwiki
> > [INFO] snapshot
> > org.codehaus.mojo:selenium-maven-plugin:1.0-beta-2-SNAPSHOT: checking
> > for updates from openqa.org
> > Downloading: http://maven.xwiki.org/org/codehaus/mojo/selenium-
> > maven-plugin/1.0-beta-2-SNAPSHOT/selenium-maven-plugin-1.0-beta-2-
> > SNAPSHOT.pom
> > 8K downloaded
> > Downloading: http://maven.xwiki.org/org/codehaus/mojo/selenium-
> > maven-plugin/1.0-beta-2-SNAPSHOT/selenium-maven-plugin-1.0-beta-2-
> > SNAPSHOT.jar
> > 12K downloaded
> >
> > Is it possible that the snapshot in the xwiki repository is too old?
> > Otherwise how do I force it to download from the "official"
> > repository?
> >
> > Regards,
> > Catalin
>
>




More information about the devs mailing list