PHPUnit在命令行上运行selenium测试,但不是通过jenkins构建

时间:2012-04-25 12:31:25

标签: selenium phpunit jenkins

我有一个运行selenium phpunit测试的ant构建脚本。我可以在命令行上运行构建脚本,我看到测试正在进行,浏览器窗口打开,并且执行了selenium测试。 在命令行上都很好。

然而如果我创建了一个jenkins作业来运行构建脚本。 它失败,因为它试图运行phpunit任务。这是控制台输出。

似乎当jenkins运行构建时,它无法访问selenium。 请参阅'拒绝访问权限'无法显示网页' 任何帮助都将非常感激!

PHPUnit的:

 [exec] PHPUnit 3.6.10 by Sebastian Bergmann.
 [exec] 
 [exec] The Xdebug extension is not loaded. No code coverage will be generated.
 [exec] 
 [exec] 
 [exec] E
 [exec] 
 [exec] 
 [exec] Time: 1 second, Memory: 3.75Mb
 [exec] 
 [exec] There was 1 error:
 [exec] 
 [exec] 1) Example::testPokerMainNav
 [exec] Issues while capturing the screenshot:
 [exec] Invalid response while accessing the Selenium Server at 'http://localhost:4444/selenium-server/driver/': <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
 [exec] <HTML>
 [exec]     <HEAD>
 [exec]         <title>Web Page Cannot Be Displayed</title>
 [exec]         <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
 [exec]         <style>
 [exec]         <!--
 [exec] 
 [exec]             body {
 [exec]                 font-family: Arial,Sans-serif;
 [exec]             }
 [exec] 
 [exec]             li {
 [exec]                 padding-top: 5px;
 [exec]             }
 [exec] 
 [exec]             .messageBox {
 [exec]                 BORDER-TOP: #9c9a9c 1px solid;
 [exec]                 BORDER-LEFT: #9c9a9c 1px solid;
 [exec]                 BORDER-RIGHT: #9c9a9c 1px solid;
 [exec]                 BORDER-BOTTOM: #9c9a9c 1px solid;
 [exec]             }
 [exec] 
 [exec]             .alertTitle
 [exec]             {
 [exec]                 color: #676767;
 [exec]                 FONT-SIZE: 12px;
 [exec]                 font-weight: bold;
 [exec]             }
 [exec] 
 [exec]             .alertText
 [exec]             {
 [exec]                 color: #676767;
 [exec]                 FONT-SIZE: 11px;
 [exec]                 font-weight: normal;
 [exec]                 padding-left: 15px;
 [exec]                 padding-right: 15px;
 [exec]             }
 [exec] 
 [exec]         -->
 [exec]         </style>
 [exec]     </HEAD>
 [exec]     <body>
 [exec]         <table border="0" width="100%" height="100%" cellpadding="0" cellspacing="0">
 [exec]             <tr>
 [exec]                 <td align="center" valign="center">
 [exec]                     <table>
 [exec]                         <tr>
 [exec]                             <td>
 [exec]                                 <table border="0" class="messageBox">
 [exec]                                     <tr>
 [exec]                                         <td height="25">&nbsp;</td>
 [exec]                                     </tr>
 [exec]                                     <tr>
 [exec]                                         <td align="center">
 [exec]                                             <table border="0" width="490">
 [exec]                                                 <tr>
 [exec]                                                     <td class="alertTitle" align="center">
 [exec]                                                         <strong>Unable to display page</strong>
 [exec]                                                     </td>
 [exec]                                                 </tr>
 [exec]                                                 <tr class="spacerRow">
 [exec]                                                     <td></td>
 [exec]                                                 </tr>
 [exec]                                                 <tr>
 [exec]                                                     <td class="alertText" align="left">
 [exec]                                                         It has not been possible to display the page you requested for the following reason:
 [exec]                                                         <ul>
 [exec]                                                             <li>Access Denied</li>
 [exec]                                                         </ul>
 [exec]                                                         Contact your system administrator if you continue to experience difficulties.
 [exec]                                                     </td>
 [exec]                                                 </tr>
 [exec]                                             </table>
 [exec]                                         </td>
 [exec]                                     </tr>
 [exec]                                     <tr>
 [exec]                                         <td height="25">&nbsp;</td>
 [exec]                                     </tr>
 [exec]                                 </table>
 [exec]                             </td>
 [exec]                         </tr>
 [exec]                         <tr>
 [exec]                             <td align="right"><asp:Label id="lblDateTime" runat="server" CssClass="AlertText" /></td>
 [exec]                         </tr>
 [exec]                     </table>
 [exec]                 </td>
 [exec]             </tr>
 [exec]         </table>
 [exec]     </body>
 [exec] </HTML>
 [exec] 
 [exec] Invalid response while accessing the Selenium Server at 'http://localhost:4444/selenium-server/driver/': <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
 [exec] <HTML>
 [exec]     <HEAD>
 [exec]         <title>Web Page Cannot Be Displayed</title>
 [exec]         <meta name="vs_targetSchema" content="

建立失败

Selenium:selenium-server-standalone-2.21.0.jar。

从Firebug selenium IDE导出的PHPunits测试。

PHPUnit:3.6.10。

1 个答案:

答案 0 :(得分:0)

我在ubuntu中设置了http_proxy环境文件。

出于某种原因,jenkins用户试图通过代理连接到我的网站。 然而,该网站与詹金斯在同一个盒子上。因此失败了。

我删除了http_proxy,重新启动了ubuntu并且工作正常。

仍然令人费解,但它现在正在运作。