Question

My website has a Login page, so it needs to login first to run each HTML selense test file. The way PHPUnit framework works is creating independent test cases by running each test independently, which means it calls the Setup() function on each test case --> then calls Selenium RC Server --> then creates session id. My code is below.

require_once 'PHPUnit/Extensions/SeleniumTestCase.php';

class SeleneseTests extends PHPUnit_Extensions_SeleniumTestCase
{
   protected static $seleneseDirectory = '/home/server/Web/phase-four/tests';

   protected function setUp()
  {
    $this->setBrowser("*firefox");
    $this->setBrowserUrl("http://mywebsite.com/");
  }
}

No correct solution

OTHER TIPS

My selenium rc setup seems to keep the same session for each test by default, as long as I am setting the session (doing login) inside the setUp() function.

There is also a -browserSessionReuse flag you can specify when starting the rc server, in case this behavior is not enabled by default.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top