Cameron Hurd
Cameron Hurd

Reputation: 5041

Behat Quits Unexpectedly

I'm pulling up blanks here about this very odd behaviour that I'm seeing from behat.

When I run even the most basic of tests, behat stops completely.

Sample output:

$ php bin/behat src/App/CoreBundle/Features/home.feature --suite troubleshoot_suite
Feature: Homepage
    In order to establish the application's value
    As an End User
    I need to be able to see a introduction page

  Scenario: Load Homepage
$ ~/Sites/

...it just hangs there!

I've got Behat version 3.0.14, and have been running tests that worked without issue.

Here's my behat.yml:

default:
    suites:
        core_suite:
            type: symfony_bundle
            bundle: 'AppCoreBundle'
            contexts:
                - App\CoreBundle\Features\Context\FeatureContext
                - Kf\KitBundle\Behat\FOSUserContext
                - Behat\MinkExtension\Context\MinkContext
        troubleshoot_suite:
            type: symfony_bundle
            bundle: 'AppCoreBundle'
            contexts:
                - App\CoreBundle\Features\Context\TestContext

    extensions:
        Behat\Symfony2Extension: ~
        Behat\MinkExtension:
            sessions:
                default:
                    symfony2: ~
                javascript:
                    selenium2: ~
            show_auto:    false
            base_url: http://app.dev

My TestContext.php:

<?php

namespace App\CoreBundle\Features\Context;

use Kf\KitBundle\Behat\DefaultContext,
    Kf\KitBundle\Behat\WebContext;
use App\CoreBundle\Entity\Dog,
    App\CoreBundle\Entity\Park,
    App\CoreBundle\Entity\CheckIn,
    App\CoreBundle\Entity\DogBreed;
use Behat\Gherkin\Node\TableNode;
use Behat\MinkExtension\Context\MinkContext;

class TestContext extends MinkContext
{
    /**
     * @When /^I go to the website root$/
     */
    public function iGoToTheWebsiteRoot()
    {
        $this->getSession()->visit('/');
    }
}

And the home.feature file I'm trying to run:

Feature: Homepage
    In order to establish the application's value
    As an End User
    I need to be able to see a introduction page

    Scenario: Load Homepage
        Given I go to the website root
        Then I should see "Something expected."
        And I should not see "Something unexpected."

Has anyone ever encountered a similar issue or behaviour? My test.log is nothing exciting, either:

[2014-10-23 12:58:04] request.INFO: Matched route "app_core_default_index" (parameters: "_controller": "App\CoreBundle\Controller\DefaultController::indexAction", "_route": "app_core_default_index") [] []
[2014-10-23 12:58:04] security.INFO: Populated SecurityContext with an anonymous Token [] []
[2014-10-23 12:58:04] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener::injectLogger". [] []
[2014-10-23 12:58:04] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener::injectLogger". [] []
[2014-10-23 12:58:04] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener::injectLogger". [] []
[2014-10-23 12:58:04] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::configure". [] []
[2014-10-23 12:58:04] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelRequest". [] []
[2014-10-23 12:58:04] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\TestSessionListener::onKernelRequest". [] []
[2014-10-23 12:58:04] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\SessionListener::onKernelRequest". [] []
[2014-10-23 12:58:04] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\FragmentListener::onKernelRequest". [] []
[2014-10-23 12:58:04] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest". [] []
[2014-10-23 12:58:04] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleListener::onKernelRequest". [] []
[2014-10-23 12:58:04] event.DEBUG: Notified event "kernel.request" to listener "FOS\RestBundle\EventListener\BodyListener::onKernelRequest". [] []
[2014-10-23 12:58:04] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\Security\Http\Firewall::onKernelRequest". [] []
[2014-10-23 12:58:04] event.DEBUG: Notified event "kernel.request" to listener "Knp\Bundle\MenuBundle\EventListener\VoterInitializerListener::onKernelRequest". [] []
[2014-10-23 12:58:04] event.DEBUG: Notified event "kernel.request" to listener "Knp\Bundle\PaginatorBundle\Subscriber\SlidingPaginationSubscriber::onKernelRequest". [] []
[2014-10-23 12:58:04] event.DEBUG: Notified event "kernel.request" to listener "Nelmio\ApiDocBundle\EventListener\RequestListener::onKernelRequest". [] []
[2014-10-23 12:58:04] event.DEBUG: Notified event "kernel.request" to listener "Stof\DoctrineExtensionsBundle\EventListener\BlameListener::onKernelRequest". [] []
[2014-10-23 12:58:04] event.DEBUG: Notified event "kernel.controller" to listener "App\UserBundle\EventListener\UserIncompleteListener::onKernelController". [] []
[2014-10-23 12:58:04] event.DEBUG: Notified event "kernel.controller" to listener "FOS\RestBundle\EventListener\ParamFetcherListener::onKernelController". [] []
[2014-10-23 12:58:04] event.DEBUG: Notified event "kernel.controller" to listener "Symfony\Bundle\FrameworkBundle\DataCollector\RouterDataCollector::onKernelController". [] []
[2014-10-23 12:58:04] event.DEBUG: Notified event "kernel.controller" to listener "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector::onKernelController". [] []
[2014-10-23 12:58:04] event.DEBUG: Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener::onKernelController". [] []
[2014-10-23 12:58:04] event.DEBUG: Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener::onKernelController". [] []
[2014-10-23 12:58:04] event.DEBUG: Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\HttpCacheListener::onKernelController". [] []
[2014-10-23 12:58:04] event.DEBUG: Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\SecurityListener::onKernelController". [] []
[2014-10-23 12:58:04] event.DEBUG: Notified event "kernel.controller" to listener "FOS\RestBundle\EventListener\ViewResponseListener::onKernelController". [] []

Upvotes: 2

Views: 196

Answers (2)

Cameron Hurd
Cameron Hurd

Reputation: 5041

As @IanBytchek alluded to above, it was a very obvious problem.

It turned out to be my version of PHP.

I had been trying to re-compile it with the intl extension, and I can't be sure where I went wrong, but when I ran /usr/bin/php bin/behat ... to ignore my botched MAMP version of PHP, my tests worked as expected once again.

Upvotes: 0

Ian Bytchek
Ian Bytchek

Reputation: 9085

Probably something very obvious is missing as everything you have provided looks ok. Behat provides a --verbose option for detailed debug information. Try using that to get to the bottom of the problem.

php bin/behat src/App/CoreBundle/Features/home.feature --verbose --suite troubleshoot_suite 

Upvotes: 1

Related Questions