Run a PHPUnit Selenium test case programatically ("within PHP") -


how can run test "within php" instead of using 'phpunit' command? example:

<?php require_once 'phpunit/extensions/seleniumtestcase.php'; class myseleniumtest extends phpunit_extensions_seleniumtestcase {      protected function setup() {         $this->setbrowser("*firefox");         $this->setbrowserurl("http://example.com/");     }      public function testmytestcase() {         $this->open("/");         $this->click("//a[@href='/contact/']");     }  }  $test = new myseleniumtest(); //i want run test , information results can store them in database, send email etc. ?> 

or have write test file, invoke phpunit via system()/exec() , parse output? :(

just use driver that's included.

require_once 'phpunit/extensions/seleniumtestcase/driver.php'; //you may need load few other libraries.  try it. 

then need set seleniumtestcase does:

$driver = new phpunit_extensions_seleniumtestcase_driver; $driver->setname($browser['name']); $driver->setbrowser($browser['browser']); $driver->sethost($browser['host']); $driver->setport($browser['port']); $driver->settimeout($browser['timeout']); $driver->sethttptimeout($browser['httptimeout']); 

then just:

$driver->open('/'); $driver->click("//a[@href='/contact/']"); 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -