gpt4 book ai didi

php - Codeception 功能和验收测试错误

转载 作者:行者123 更新时间:2023-11-28 20:08:42 25 4
gpt4 key购买 nike

我在 vagrant box 上运行最新版本的 Codeception,但我无法进行验收或功能测试。

这是acceptance.suite.yml:

class_name: AcceptanceTester
modules:
enabled:
- PhpBrowser
- AcceptanceHelper
config:
PhpBrowser:
url: 'http://test.dev'

和我的验收测试:

$I = new AcceptanceTester($scenario);
$I->wantTo('check Codeception');

$I->amOnPage('/');

$I->see('hello');

索引页是一个带有“hello world”的简单 html 输出

我得到的错误如下:

1) Failed to check codeception in testTestCept (/vagrant/test/tests/acceptance/testTestCept.php)
Sorry, I couldn't am on page "http://test.dev/":
GuzzleHttp\Exception\RequestException: cURL error 6: Couldn't resolve host 'test.dev'

Scenario Steps:
1. I am on page "http://test.dev/"

#1 /vagrant/fmx/vendor/guzzlehttp/guzzle/src/Adapter/Curl/CurlAdapter.php:91
#2 /vagrant/fmx/vendor/guzzlehttp/guzzle/src/Adapter/StreamingProxyAdapter.php:34
#3 /vagrant/fmx/vendor/guzzlehttp/guzzle/src/Client.php:186
#4 /vagrant/fmx/vendor/symfony/browser-kit/Symfony/Component/BrowserKit/Client.php:332
#5 /vagrant/fmx/tests/acceptance/AcceptanceTester.php:128
#6 /vagrant/fmx/tests/acceptance/testTestCept.php:5
#1 /vagrant/fmx/vendor/guzzlehttp/guzzle/src/Adapter/Curl/CurlAdapter.php:91
#2 /vagrant/fmx/vendor/guzzlehttp/guzzle/src/Adapter/StreamingProxyAdapter.php:34
#3 /vagrant/fmx/vendor/guzzlehttp/guzzle/src/Client.php:186
#4 /vagrant/fmx/vendor/symfony/browser-kit/Symfony/Component/BrowserKit/Client.php:332
#5 /vagrant/fmx/tests/acceptance/AcceptanceTester.php:128
#6 /vagrant/fmx/tests/acceptance/testTestCept.php:5

我的功能测试同样简单:

$I = new FunctionalTester($scenario);
$I->wantTo('check Codeception');

$I->amOnPage('/');

$I->see('hello');

有了这个,我得到以下错误:

There was 1 error:

---------
1) Failed to check codeception in testTestCept (/vagrant/test/tests/functional/testTestCept.php)
#1 /vagrant/test/tests/functional/testTestCept.php:5
#2 /vagrant/test/tests/functional/testTestCept.php:5

第5行具体是:$I->amOnPage('/');

我是 vagrant 的新手,所以我不确定我是否遗漏了设置中的某些内容,或者我是否做错了其他事情。我正在通过 vagrant ssh 运行代码接收。

更新:

我们已经进行了验收测试。现在只关注功能测试。根据要求,下面是完整的 functional.suite.yml 内容。由于我是分阶段设置的,所以我实际上并没有修改它:

# Codeception Test Suite Configuration

# suite for functional (integration) tests.
# emulate web requests and make application process them.
# Include one of framework modules (Symfony2, Yii2, Laravel4) to use it.

class_name: FunctionalTester
modules:
enabled: [Filesystem, FunctionalHelper]

最佳答案

我遇到了同样的问题,这对我有帮助:

unable to run codeception in virtual machine -Mink could not be found and loaded

我需要在我的/etc/hosts 文件中为我的虚拟机中的站点添加一个条目。

关于php - Codeception 功能和验收测试错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24437938/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com