2

I'm running the latest version of Codeception on a vagrant box and I can't get either the acceptance or functional testing working.

Here's acceptance.suite.yml:

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

and my acceptance test:

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

$I->amOnPage('/');

$I->see('hello');

The index page is a simple html output with 'hello world'

The error I'm getting is as follows:

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

My functional test is just as simple:

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

$I->amOnPage('/');

$I->see('hello');

With this one I get the following error:

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

Line 5 is specifically: $I->amOnPage('/');

I'm new to vagrant so I'm not sure if I've missed something in the setup or if I've done something else wrong. I'm running codeception through vagrant ssh.

UPDATE:

We've got the Acceptance testing working. Now just focusing on the Functional testing. As requested, below is the complete functional.suite.yml content. As I'm setting up in stages, I've not actually modified this:

# 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]
5
  • I think amOnPage() method cannot accept full url. Try amOnPage('/') for your acceptance test (functional is another case so there is another problem). Commented Jun 27, 2014 at 8:59
  • Sorry Phantom: I did actually try it both ways I missed the edit on the output to show it correctly I used amOnPage('/') and it still didn't work. Commented Jun 27, 2014 at 16:53
  • Try url: 'http://test.dev:80' Commented Jun 28, 2014 at 5:29
  • tried that @The Shift Exchange and it didn't work. same result :/ Commented Jul 1, 2014 at 20:10
  • because you are running codeception within vagrant - perhaps it needs to be "localhost" or "192.168.0.1" or something like that. check your settings within vagrant for the website address Commented Jul 2, 2014 at 5:39

1 Answer 1

2

I had the same problem and this helped me:

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

I needed to add an entry in my /etc/hosts file for my site inside of my vm.

Sign up to request clarification or add additional context in comments.

4 Comments

woot! that's worked with my acceptance test, but my functional test is still failing. Could there be somewhere else in codeception that i have to update a path? :/
I doubt it, since the functional tests don't use a webserver. Can you post your functional.suite.yml file?
added, but it's all the same as from the initial install. I've not changed anything here yet. It's still the same amOnPage() that's causing the error as it was in the acceptance testing which is why i hoped they were related :/
I could be wrong, but it doesn't look like there is a framework set in your modules. Have you walked through the documentaiton found here: Functional Test Documentation ? It will walk you through setting up your functional.suite.yml file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.