基于php论文测试用例,以编程方式运行PHPUnit Selenium测试用例(“在PHP内”)

芮立果
2023-12-01

如何在“

PHP内”运行测试而不是使用’phpunit’命令?例:

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 to run the test and get information about the results so I can store them in the database, send an email etc.

?>

或者我是否必须将测试写入文件,通过system()/ exec()调用phpunit并解析输出? 

 类似资料: