以编程方式运行PHPUnit Selenium测试用例(“在PHP内”)
发布时间:2020-12-13 13:27:53 所属栏目:PHP教程 来源:网络整理
导读:如何在“ PHP内”运行测试而不是使用’phpunit’命令?例: ?phprequire_once 'PHPUnit/Extensions/SeleniumTestCase.php';class MySeleniumTest extends PHPUnit_Extensions_SeleniumTestCase { protected function setUp() { $this-setBrowser("*firefox")
如何在“
PHP内”运行测试而不是使用’phpunit’命令?例:
<?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 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并解析输出? (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |