Jamie.Good
Jamie.Good

Reputation: 351

PHPUnit runs selenium tests on command line but not via jenkins builds

I have an ant build script that runs selenium phpunit tests. I can run the build script on the command line and I see the tests proceeding, browser windows opening and the selenium tests are carried out. All good on the command line.

However if i get create a jenkins jobs to run the build script. It fails as it attempts to run the phpunit task. this is console output.

It seems that when jenkins runs the build it can't access selenium. See 'Access denied' and 'Web Page Cannot Be Displayed' Any help would be most appreciated!

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="

BUILD FAILED

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

PHPunits tests exported from Firebug selenium IDE.

PHPUnit: 3.6.10.

Upvotes: 2

Views: 733

Answers (1)

Jamie.Good
Jamie.Good

Reputation: 351

I had a http_proxy set the the environment file in ubuntu.

For some reason, the jenkins user was trying to connect to my website via the proxy. However the website was on the same box as jenkins. Hence the fail.

I removed the http_proxy, restarted ubuntu and it worked.

Still puzzling but it's working now.

Upvotes: 0

Related Questions