Search code examples
seleniumyamlbddbehatgherkin

Define multiple tags and remove suites in behat.yml


I want to define multiple tags in behat.yml which correspond to suite names. There are 4 suites inside the features folder and each of them have multiple .feature files.

Ex: admin, themes

Tags to be defined: @admin, @themes.

Previously the behat.yml file contained suites for admin and themes. Now I want to define 3 different profiles (server1, server2 and server3) corresponding to different testing environments and use tags instead of suites to run the feature files containing those tags. I have added the tags @admin and @themes in every feature file of themes and admin folder.

How should I implement this specific case in my config file? Any assistance is greatly appreciated


Solution

  • You can have different profiles and themes as per the docs

    So one possible way to do it, would be to group the suites for each profile.

    server1:
      suites:
        default:
            contexts:
                - FeatureContext
            filters:
                tags: "@admin"
    server2:
        suites:
            default:
                contexts:
                    - FeatureContext        
                filters:
                    tags: "@admin"
    
    server3:
        suites:
            default:
                contexts:
                    - FeatureContext        
                filters:
                    tags: "@admin,@themes"