我正在尝试在Yii2上设置代码测试。我的堆栈是:vagrant + Selenium + chromedriver + PHP 7.1。这是我的概念配置:
actor: AcceptanceTester
modules:
enabled:
- WebDriver:
url: 'http://localhost:8080/'
window_size: 1920x1080
browser: chrome
capabilities:
chromeOptions:
args: ["--no-sandbox", "--headless", "--disable-gpu"]
binary: "/usr/bin/google-chrome-stable"
- Yii2:
part: [orm,email]
entryScript: index-test.php
config / test.php等于config / console.php
以下是控制台的一些输出:
./yii serve
Server started on http://localhost:8080/
Document root is "/var/www/test/web"
Quit the server with CTRL-C or COMMAND-C.
[Fri Jun 1 12:46:39 2018] ::1:45348 [200]: /
[Fri Jun 1 12:46:52 2018] ::1:45362 [200]: /
最后,我在基本模板中将PageCest与HomeCest相同并运行测试。单元测试正在进行,但验收测试将返回以下内容:
PageCest: Ensure that about page works
测试测试/验收/ PageCest.php:ensureThatAboutPageWorks
[Error] Class name must be a valid object or a string
所有方法都重复此错误是PageCest。 我做错了什么?
答案 0 :(得分:0)
问题出在codeception.yaml中。所以代码无法找到Actor类。注意拼写和填充。