PHP真的很新,我到处都寻求帮助。
所以我用'Katalon'记录了一个测试,然后允许您将测试导出到PHP。我现在正在尝试使用Selenium和PHPUnit在Codeception中运行测试。
问题是我不断收到以下错误:
$ ../../vendor/bin/phpunit FirstCept.php
PHPUnit 7.5.13 by Sebastian Bergmann and contributors.
E 1 / 1 (100%)
Time: 79 ms, Memory: 4.00 MB
有1个错误:
1) Test\FirstCept::testUntitledTestCase
Undefined index: SELENIUM_HUB
C:\Test\Project\tests\acceptance\FirstCept.php:27
ERRORS!
Tests: 1, Assertions: 0, Errors: 1.
Selenium Hub的代码是:
<?php
namespace Test;
use PHPUnit\Framework\TestCase;
use Facebook\WebDriver;
class FirstCept extends TestCase
{
/**
* @var WebDriver\Remote\RemoteWebDriver
*/
private $webDriver;
/**
* @var string
*/
private $baseUrl;
/**
* init webdriver
*/
public function setUp()
{
$desiredCapabilities = WebDriver\Remote\DesiredCapabilities::chrome();
$desiredCapabilities->setCapability('trustAllSSLCertificates', true);
$this->webDriver = WebDriver\Remote\RemoteWebDriver::create(
$_SERVER['SELENIUM_HUB'],
$desiredCapabilities
);
$this->baseUrl = $_SERVER['SELENIUM_BASE_URL'];
如果有人可以帮助我使它正常工作,将不胜感激。