FriendsOfBehat / SymfonyExtension

:musical_score: Extension integrating Behat with Symfony.
MIT License
472 stars 62 forks source link

Can't get it to work with Behatch Contexts #90

Closed asimonf closed 5 years ago

asimonf commented 5 years ago

When I run the command, I get this error:

 [Behat\Testwork\Argument\Exception\UnknownParameterValueException]                                                    
  Can not find a matching value for an argument `$request` of the method `Behatch\Context\RestContext::__construct()`. 

I'm not redefining the contexts as a service in the services_test.yml file.

Here's my behat config:

default:
    suites:
        default:
            contexts:
                - Behatch\Context\RestContext
                - Behatch\Context\JsonContext
                - Behat\MinkExtension\Context\MinkContext

    extensions:
        FriendsOfBehat\SymfonyExtension: ~

Any tips to find the problem? Cheers!

pamil commented 5 years ago

Have you tried using behatch:context:rest and behatch:context:json as mentioned in Behatch docs?

asimonf commented 5 years ago

Yes. When I attempt that, the error I get is this:

In UninitializedContextEnvironment.php line 44:

  [Behat\Behat\Context\Exception\ContextNotFoundException]             
  `behatch:context:rest` context class not found and can not be used.  

I'm not discarding that the fault is mine, but neither docs nor previous issues seem to clear things up for me. I've been trying to find the issue by myself, but I'm not closer to the answer.

asimonf commented 5 years ago

I'd like to add a bit more info. The demo feature included in the default flex installation passed just fine. So apparently the installation is alright.

asimonf commented 5 years ago

I'm going to leave this for future reference but it was indeed my own stupidity. The required config for behatch to work is the following:

default:
    suites:
        default:
            contexts:
                - Behatch\Context\RestContext
                - Behatch\Context\JsonContext
                - Behat\MinkExtension\Context\MinkContext

    extensions:
        FriendsOfBehat\SymfonyExtension: ~
        Behatch\Extension: ~
        Behat\MinkExtension:
            base_url: "http://example.com/"
            sessions:
                default:
                    symfony: ~

Sorry to waste your time!