jhedstrom / drupalextension

An integration layer between Behat, Mink Extension, and Drupal.
GNU General Public License v2.0
209 stars 192 forks source link

Unable to list definitions #226

Open mortona42 opened 8 years ago

mortona42 commented 8 years ago

I followed the steps in the full documentation for the stand alone installation, but when I run [bin/behat -di (or -dl)], nothing is listed.

jhedstrom commented 8 years ago

What happens if you add --verbose? Anything different? Could you post a copy of your behat.yml here?

mortona42 commented 8 years ago

Adding --verbose still gives empty output.

For behat.xml I tried with the samples in the full documentation and in this repo's readme:

default:
  suites:
    default:
      contexts:
        - Drupal\DrupalExtension\Context\DrupalContext
  extensions:
    Behat\MinkExtension:
      goutte: ~
      base_url: http://localhost:80
    Drupal\DrupalExtension:
      blackbox: ~

Thanks for your response!

kevinquillen commented 8 years ago

I am having the same issue, a little different though.

If I do vendor/bin/behat -c behat.yml -dl, I see all the definitions.

When I execute Behat in command line or from PHPStorm, it claims the step I am using is missing. How can that be if I am executing it with the -c behat.yml (which is default anyway)? How is it unaware of the steps?

--- FeatureContext has missing steps. Define them with these snippets:

    /**
     * @When I go to :arg1
     */
    public function iGoTo($arg1)
    {
        throw new PendingException();
    }

Config:

default:
  suites:
    default:
      contexts:
        - FeatureContext
        - Drupal\DrupalExtension\Context\DrupalContext
        - Drupal\DrupalExtension\Context\MinkContext
        - Drupal\DrupalExtension\Context\MessageContext
        - Drupal\DrupalExtension\Context\DrushContext
  extensions:
    Behat\MinkExtension:
      goutte: ~
      selenium2: ~
      base_url: http://local.d8contrib
    Drupal\DrupalExtension:
      api_driver: 'drupal'
      blackbox: ~
      drupal:
        drupal_root: '/var/www/docroot'

FeatureContext.php:

<?php

use Drupal\DrupalExtension\Context\RawDrupalContext;
use Behat\Behat\Context\SnippetAcceptingContext;
use Behat\Gherkin\Node\PyStringNode;
use Behat\Gherkin\Node\TableNode;

/**
 * Defines application features from the specific context.
 */
class FeatureContext extends RawDrupalContext implements SnippetAcceptingContext {

  /**
   * Initializes context.
   *
   * Every scenario gets its own context instance.
   * You can also pass arbitrary arguments to the
   * context constructor through behat.yml.
   */
  public function __construct() {
  }

}

I am also trying to run just a very basic test against D8, when a user visits the homepage.

This is with version 3.1.3 of the Drupal extension.

kevinquillen commented 8 years ago

My bad.... a very easy mistake. Here was my Feature:

@api
Feature: Test the Fruit Form
  In order to prove Drupal serves up an example form asking what your favorite fruit is
  As a developer
  I need to use the step definitions of this context

  Scenario: Visiting '/testmodule/ask-user' displays the fruit form
    When I go to '/testmodule/ask-user'
    Then I should see the heading 'Fruit Form'

The paths should be in double quotes, not single quotes. Then, Behat worked. I should have realized that yesterday, but wasn't thinking clearly about what Behat was telling me apparently. I interpreted it as it not knowing about the additional Drupal steps, when really I had a typo.

aronbeal commented 8 years ago

@mortona42, just checking - you said 'behat.xml'. Wanted to make sure that was a typo - behat's going to look for 'behat.yml', and it might explain your difficulties.

migueljds commented 8 years ago

@mortona42 did you ever resolve the issue? I'm having the exact same issue

mortona42 commented 8 years ago

Ahh which I could help, but I have long forgotten what I was working on here.