selenium - Structuring cucumber feature files for various mobile devices -


i'm building mobile apps test automation using java, cucumber-jvm, appium.

for various scenarios, in order make scenario verbose, have added following line @ start of scenario/scenario outline / background of bdd feature files. example:

 given user ios device "iphone se simulator"  , select book product  , select layout type "square" 

.. example

 given user ios device "iphone 7"   , select book product   , select layout type "square" 

.. example

 given user ios device "iphone 6"   , select book product   , select layout type "tav" 

now, have got many devices, best way reuse step. avoid using scenario outline & parameterize on type?

also, we're okay slight repetition/duplication of feature files, if helps build test suite.

kindly suggest

thanks

1) specify device command line:

-ddevice="iphone 6" 

2) capture device command line in before hook

class cliparams {   private static string device;   public static void setdevice();   public static string getdevice(); }  class hook {   @beforeall   public beforeall() {     cliparams.setdevice(system.getproperty("device", "iphone 7"));   } } 

3) step in feature file

given user mobile device "iphone se simulator" given user mobile device "iphone 6" given user mobile device "google neux" 

4) step definition of first line

given("^user mobile device \"(.?)\"$", (device)->{   // ignore deivce step description   // instead use device command line   cliparams.getdevice(); }) 

5) how pass jvm args in eclipse eclipse run configuration

for other ide, intellij/netbean should has similar place specify jvm args, if run command line append -ddevice="iphon 7" command


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -