FriendsOfBehat/SymfonyExtension

Can't get it to work with Behatch Contexts

asimonf opened this issue · 4 comments

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

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

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.

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.

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!