使用 Jenkins 执行 Selenium 2 jar 作为 PHPUnit 测试的一部分会引发错误
我构建了一个小型 java 应用程序,它使用 selenium 2 打开网页并返回其结果。
该应用程序作为 PHPUnit 测试的一部分被调用,而 PHPUnit 测试又作为 ANT 构建的一部分运行。
问题是当 Jenkins 构建项目并运行测试时,显示以下错误
org.openqa.selenium.firefox.NotConnectedException:无法连接 45000 毫秒后在端口 7055 上托管 127.0.0.1
当我在 jenkis 工作目录中的命令行中运行构建时,一切正常。我认为问题在于詹金斯服务没有足够的安全权限。
这是 jenkis 构建的控制台输出的第一行
由用户匿名发起
操作系统是Ubuntu 9
块引用
I've build a small java application that uses selenium 2 to open a web page and return its result.
The application is called as a part of a PHPUnit test which is in turn run as part of an ANT build.
The problem is when the Jenkins builds the project and runs the test the following error shows
org.openqa.selenium.firefox.NotConnectedException: Unable to connect
to host 127.0.0.1 on port 7055 after 45000 ms
When I run the build in the command line in the jenkis working directory it all works fine. I think that the problems is that the jenkins service doesn't have enought security permissions.
This is the first line of the console output of the jenkis build
Started by user anonymous
The os is Ubuntu 9
Blockquote
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是 jenkins 用户无法连接到 X 会话。解决方案非常简单。
首先我们需要安装一个vnc服务器:
然后我们需要切换到 jenkins 用户并首次启动 vncserver 以设置其密码:
我设置的密码是jenkins,并且我已用N回答您是否要创建仅供查看的密码。
然后我需要在 jenkins 插件管理面板上安装 Xvnc 插件,并勾选“在构建期间运行 vnc 服务器”复选框。
其他一切都很好。
The problem was that the jenkins user wasn't able to connect to a X sessions. The solution was really simple.
First we need to install a vnc server:
Then we need to switch to the jenkins user and start the vncserver for the first time in order to set its password:
The password I'v set is jenkins and I've answered with N to the do you wan't to create a view only password.
Then I needed to install the Xvnc plugin on the jenkins plugin administration panel and to tick the "Run a vnc server during" builds checkbox.
Everything else worked just fine.