androidcucumberautomated-testscalabash

How to target specific Calabash feature files?


I've been looking for this answer for quite a while and I'm not able to figure it out just yet.

Say I have a test environment and a production one. I created calabash scenarios which need to be different whether I'm running on test or prod. All my scenarios have been written in /feature/xxx.feature

Problem being, when I run the tests, all the *.feature will be run. Therefore I created an environment variable which I change according to which environment I wanna run the test onto.

How can I target the right .feature files? How to tell Calabash: when the environment variable is set to "production" please only run the /feature/prodution/.feature files?*

Thank you very much for your help!


Solution

  • This is really a cucumber question.

    I recommend using tags. The examples below are for iOS, but the principles apply to Android.

    https://github.com/cucumber/cucumber/wiki/Tags

    You can see how we use tags in theCalabash iOS Smoke Test App.

    # Run the animation tests
    $ bundle exec cucumber -t @animations
    
    # Run the backdoor tests
    $ bundle exec cucumber -t @backdoor
    

    You can combine tags with cucumber profiles for more advanced behaviors.

     # Run the backdoor tests in the production environment
     $ bundle exec -p production -t @backdoor