user3574492
user3574492

Reputation: 6435

Behat Fatal error: Interface 'Behat\Behat\Context\Context' not found

I am trying to run a Behat feature file after installing and configuring successfully. I get the following error:

Fatal error: Interface 'Behat\Behat\Context\Context' not found in C:\Apache24\htdocs\drupal\sites\all\themes\ec_resp\emn_ies_subtheme\vendor\behat\behat\features\bootstrap\FeatureContext.php on line 22

Line 22 in FeatureContext.php:

class FeatureContext implements Context

The Context class is being referenced from:

use Behat\Behat\Context\Context;

Here is my folder structure:

enter image description here

Don't know what is going wrong here as I haven't changed or moved any of the core Behat files.

Any help would be appreciated.

Upvotes: 0

Views: 1042

Answers (1)

Malte Kölle
Malte Kölle

Reputation: 192

I might be a bit late, but I was facing the same issue. The problem was, that I ran the behat file in the wrong folder.

So my folder structure looks like this:

|-project
|
|--tests
|
|---vendor
|
|----bin
|
|-----behat

If I try to run the behat file in my project folder like this:

[project]$ test/vendor/bin/behat

I'll get the error

FeatureContext context class not found and can not be used.

So I have to be in the tests folder then I can run the tests without a Problem.

[tests]$ vendor/bin/behat

Hopefully it is still answering the question.

Upvotes: 0

Related Questions