Note that there are some explanatory texts on larger screens.

plurals
  1. POSelenium RC / PHPUnit test always times out?
    primarykey
    data
    text
    <p>I'm really new to testing so go easy on me. I've got Seleneium working with Pear, PHPUnit, and Sauce Labs class SauceOnDemandTestCase.php. I can run tests and did a simple on just fine. But now I'm doing more complicated tests and keep receiving timeout messages. I've looked the error up on StackO and other people were getting it with IE. Now my test is using Firefox so I don't know why that would be. The other post is here:</p> <p><a href="https://stackoverflow.com/questions/3846691/phpunit-framework-exception-could-not-connect-to-the-selenium-rc-server-when-i-r">PHPUnit_Framework_Exception: Could not connect to the Selenium RC server when I run with Hudson</a></p> <p>I tried changing my wait functions to waitForElement or waitForVisible but to no avail, it still fails with one error. Here is my XML log file output if that's useful to you:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;testsuites&gt; &lt;testsuite name="ExampleTest" file="C:\websites\saucelabs\ExampleTest.php" tests="1" assertions="0" failures="0" errors="1" time="44.717224"&gt; &lt;testsuite name="ExampleTest: Testing Selenium 1 in PHP at Sauce (FF 7)" tests="1" assertions="0" failures="0" errors="1" time="44.717224"&gt; &lt;testcase name="test_example" class="ExampleTest" file="C:\websites\saucelabs\ExampleTest.php" line="23" assertions="0" time="44.717224"&gt; &lt;error type="PHPUnit_Framework_Exception"&gt;ExampleTest::test_example with browser firefox 7 Windows 2003 PHPUnit_Framework_Exception: Response from Selenium RC server for open(/Home). Timed out after 30000ms. Current Browser URL: http://www.vehicleportal.co.uk/Home Sauce Labs Job: https://saucelabs.com/jobs/8b202faaa055e213233637610fcd4448 &lt;/error&gt; &lt;/testcase&gt; &lt;/testsuite&gt; &lt;/testsuite&gt; &lt;/testsuites&gt; </code></pre> <p>My script class looks like this:</p> <pre><code>&lt;?php date_default_timezone_set('Europe/London'); require_once 'PHPUnit/Extensions/SeleniumTestCase/SauceOnDemandTestCase.php'; require_once 'Log.php'; class ExampleTest extends PHPUnit_Extensions_SeleniumTestCase_SauceOnDemandTestCase { public static $browsers = array( array( 'name' =&gt; 'Testing Selenium 1 in PHP at Sauce (FF 7)', 'browser' =&gt; 'firefox', 'os' =&gt; 'Windows 2003', 'browserVersion' =&gt; '7', ) ); function setUp() { $this-&gt;setBrowserUrl('http://www.vehicleportal.co.uk'); } function test_example() { //$this-&gt;open('/'); //$this-&gt;assertTitle('Cross browser testing with Selenium - Sauce Labs'); //$file = Log::factory('file', 'out.log', 'TEST'); //$file-&gt;log("info"); $this-&gt;open("/Home"); $this-&gt;click("hlLogin1"); $this-&gt;waitForVisible('h1'); $this-&gt;type("txtLoginEmailAddress", "user@volkswagen.co.uk"); $this-&gt;type("txtLoginPassword", "password"); $this-&gt;click("btnLogin"); $this-&gt;waitForVisible('h1'); $this-&gt;verifyText("id=hlVehicleLookup", "Vehicle Lookup"); $this-&gt;click("css=img[alt=Home]"); $this-&gt;waitForVisible('h1'); $this-&gt;click("link=Logout"); $this-&gt;waitForVisible('h1'); } } </code></pre> <p>To give some background I have to create my script in Selenium IDE or SauceLabs builder and then convert it so the steps are taken from Selenium IDE. </p> <p>I have a second smaller problem which I'd like to understand better. I keep getting:</p> <p>"Notice: Undefined index: HOME in c:\php\PEAR\PHPUnit\Extensions\SeleniumTestCase\SauceOnDemandTestCase.php on line 149"</p> <p>Line 149 from that file: $yml_path = realpath($_SERVER['HOME']) . '/.sauce/ondemand.yml';</p> <p>Class for SauceLabs: <a href="https://github.com/saucelabs/phpunit-selenium-sauceondemand/blob/master/PHPUnit/Extensions/SeleniumTestCase/SauceOnDemandTestCase.php" rel="nofollow noreferrer">https://github.com/saucelabs/phpunit-selenium-sauceondemand/blob/master/PHPUnit/Extensions/SeleniumTestCase/SauceOnDemandTestCase.php</a></p> <p>I could remove the reference to this but why is it there? Afterall $_SERVER['home'] is not PHP of the $_SERVER array.</p> <p>UPDATE</p> <p>We had a theory the timeout was caused by SL not using a real browser. I removed all of the verify steps completely but the timeout still occurs.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload