selenium是php的功能吗,简单的PHP Selenium测试不起作用

我在PHP中有以下Selenium测试:

require_once('PHPUnit/Extensions/SeleniumTestCase.php');

class Example extends PHPUnit_Extensions_SeleniumTestCase

{

protected function setUp()

{

$this->setBrowser("*chrome");

$this->setBrowserUrl("http://change-this-to-the-site-you-are-testing/");

}

public function testMyTestCase()

{

$this->open("/frontend_dev.php");

try {

$this->assertTrue($this->isTextPresent("Local Coupons"));

} catch (PHPUnit_Framework_AssertionFailedError $e) {

array_push($this->verificationErrors, $e->toString());

}

}

}

当我尝试运行它时(通过运行“ php filename.php”),出现错误:

PHP Fatal error: Class 'PHPUnit_Framework_TestCase' not found in /usr/share/php/PHPUnit/Extensions/SeleniumTestCase.php on line 60

这是有道理的,因为该类未在任何地方定义,但是为什么不呢?我安装了PHPUnit.看起来有点奇怪的是,PHPUnit不会包含一个名为PHPUnit_Framework_TestCase的类.有任何想法吗?

解决方法:

对于命令行测试运行程序,您应该为PHPUnit使用read the docs.您也可以从命令行运行“ phpunit –help”.我相信您会发现您需要运行类似

phpunit path/to/filename.php

标签:selenium,phpunit,php

来源: https://codeday.me/bug/20191209/2096371.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值