The cool thing with Behat is you can create multiple suites but they can test against multiple context files. So for example let say you write a feature to perform a search on your site. You would expect the page to render x results. But you are able to test the results without hitting the ui ie by testing the response of a service or command handler by testing with the domain suite first.

So as an example I would call these suites domain & ui and then have two context files ie DomainContext, UserInterfaceContext. I would write my behat.yml file like so. Note how the paths for these features are the same. This is how I can create one feature but test against multiple context. One touching the UI the other just testing the domain.

        pretty: true
            paths: [ %paths.base%/features/joint ]
                - DomainContext
            paths: [ %paths.base%/features/joint ]
                - UserInterfaceContext
        Laracasts\Behat: ~
            default_session: laravel
            base_url: http://demo.app
            laravel: ~

So when creating your site you would want to test the domain before the UI, from console you would type "behat -s domain" This means only test the domain context. You get the idea. Now the cool thing you should get your domain all working and with right results. All you need to do then is create your ui layer and test against it.

Does this make more sense?

Return to Thread...