Phpunit 如何使用PHP在Selenium rc中调用测试用例?

Phpunit 如何使用PHP在Selenium rc中调用测试用例?,phpunit,selenium-rc,Phpunit,Selenium Rc,您能告诉我如何使用php在selenium RC中运行测试用例吗?摘自 创建一个从PHPUnit_Extensions_SeleniumTestCase扩展而来的类,该类将包含PHPUnit_Framework_TestCase中的方法和selenium特定的方法: <?php require_once 'PHPUnit/Extensions/SeleniumTestCase.php'; class WebTest extends PHPUnit_Extensions_SeleniumT

您能告诉我如何使用php在selenium RC中运行测试用例吗?

摘自

创建一个从PHPUnit_Extensions_SeleniumTestCase扩展而来的类,该类将包含PHPUnit_Framework_TestCase中的方法和selenium特定的方法:

<?php
require_once 'PHPUnit/Extensions/SeleniumTestCase.php';

class WebTest extends PHPUnit_Extensions_SeleniumTestCase
{
    protected function setUp()
    {
        $this->setBrowser('*firefox');
        $this->setBrowserUrl('http://www.example.com/');
    }

    public function testTitle()
    {
        $this->open('http://www.example.com/');
        $this->assertTitle('Example WWW Page');
    }
}
?>

然后在控制台中浏览到此文件的保存位置并运行:phpunit filename.php

如果要运行特定测试,还可以使用--filter选项

希望这有帮助