Search code examples
gitbehatmink

Behat feature files in a separate git repo


We have a lot of PHP web applications and websites. I have created a behat/mink setup that will work for all of our apps/sites. I want all sites to share a common testing setup so I want to have the /test folder under each project as a Git submodule that contains the behat/mink setup as well as the features/bootstrap/FeatureContext.php that I have customized for our sites. BUT I want the .feature files to remain as part of the app Git repo.

How can I pull this off?

If is simply add *.feature to a .gitignore inside test, the submodule will ignore them but so does the project repo.


Solution

  • You can place your feature files outside your submodule with the following configuration:

    default:
        suites:
            default:
                paths:
                    - %paths.base%/../features
    

    Then your submodule containing the shared configuration could be in /test/behat while the feature files are placed in /test/features and are part of the main repository.