Using multiple sites in Selenium RC with PHPUnit -
i'm trying automate user scenario involves 2 websites no common base url. how can achieve this? right have unsuccessfully tried altering global variables reset each test.
public $check = true; protected function setup() { $this->setbrowser("*googlechrome"); if ($this->check==true) $this->setbrowserurl("site a"); else $this->setbrowserurl("site b"); $this->setport(4444); $this->sethost("0.0.0.0"); } public testa() { //requires site a, set check false } public testb() { //requires site b }
your code won't work since setup() executed before every test case run.
why not being more explicit you're trying do? try following:
private $sites = array('a' => 'a.com', 'b' => 'b.com'); protected function setup() { $this->setbrowser("*googlechrome"); $this->setport(4444); $this->sethost("0.0.0.0"); } public function testa() { $this->usesite('a'); } public function testb() { $this->usesite('b'); } private function usesite($site) { $this->setbrowserurl($this->sites[$site]); }
Comments
Post a Comment