Executing Selenium tests from Jenkins by calling Ant

I have an ant script that runs some Selenium tests. This works great when running from Windows and also in the Putty bash terminal as user Jenkins

, since the required one is vncserver

started by the user Jenkins

previously and the variable is DISPLAY

set to :43

, I am calling the same ant script on the Jenkins CI server. The environment variable is DISPLAY

configured in the Jenkins web interface for :43

too. The error message I received looks like this:

[junit] Setting selenium logging level to: FINE
[junit] org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host on port 7056 after 45000 ms. Firefox console output:
[junit] Xlib: connection to ":43.0" refused by server
[junit] Xlib: No protocol specified
[junit] Error: cannot open display: :43
[junit] at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:95)
[junit] at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:157) 
[junit] at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:93)
[junit] at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:136) [junit] at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:78)
[junit] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [junit] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) [junit] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) [junit] at java.lang.reflect.Constructor.newInstance(Constructor.java:513) [junit] at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)


This message is very similar to the one I received when it vncserver

was started by another user and then by someone who started tests. However, this is no longer the case as I double-checked that both the tesorunner and VNC are running Jenkins


This is a Solaris server, if any details are needed to help me ask.


source to share

1 answer

I haven't done anything differently, but this was fixed a while ago, so it was a good approach. The magic just happens .. :-)



All Articles