微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

以编程方式运行PHPUnit Selenium测试用例(“在PHP内”)

如何在“ 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并解析输出

原文地址:https://www.jb51.cc/php/137480.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐