Codeception功能和验收测试错误

时间:2014-06-26 18:46:14

标签: php testing codeception

我在流浪盒上运行最新版本的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 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]

1 个答案:

答案 0 :(得分:2)

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

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

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