【问题标题】:PHPUnit runs selenium tests on command line but not via jenkins buildsPHPUnit 在命令行上运行 selenium 测试,但不是通过 jenkins 构建
【发布时间】:2012-05-06 03:18:30
【问题描述】:

我有一个运行 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-server-standalone-2.21.0.jar。

从 Firebug selenium IDE 导出的 PHPunits 测试。

PHPUnit:3.6.10。

【问题讨论】:

  • 只是为了验证:Jenkins 是在与 selenium 服务器不同的机器上还是在同一台机器上?当您在浏览器中访问http://localhost:4444/selenium-server/driver/ 时会看到什么?

标签: selenium phpunit jenkins


【解决方案1】:

我有一个http_proxy在ubuntu中设置环境文件。

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

我删除了http_proxy,重新启动了ubuntu,它工作了。

仍然令人费解,但它现在可以工作了。

【讨论】:

    猜你喜欢
    • 2016-03-24
    • 2016-11-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-23
    • 2011-05-18
    • 2015-04-07
    • 1970-01-01
    相关资源
    最近更新 更多