spock - Can GEB be used to run the same test for each set of data in a collection? -


i save user data collection , have geb run same test each set of data. thinking this.

import geb.spock.gebreportingspec import spock.lang.*  class myfirsttestspec extends gebreportingspec {      def setupspec() {        def userdata = //an array of hashes if work not care type of collection used      }      def 'run app'() {     given:             loginpage             username = 'masteruser'             password = 'apassword'             login.click()             @ homepage     when:     userdata.each{             profilepage             first = it['first']             mi = it['mi']             last = it['last']              ...... more data         }      then: 'did work'         @ reviewpage         amount1     == it['amount1']         amount2     == it['amount12']              ...... more checks    } 

}

have considered moving userdata where: block?

import geb.spock.gebreportingspec import spock.lang.*  class myfirsttestspec extends gebreportingspec {  def setupspec() { }  def 'run app'() {     given:         loginpage         username = 'masteruser'         password = 'apassword'         login.click()         @ homepage     when:         profilepage         first = firstname         mi = midname         last = lastname          ...... more data     then: 'did work'         @ reviewpage          reviewfirstname == firstname          amount1     == amount1         amount2     == amount12          ...... more checks      where:         firstname | midname | lastname | amount1 | amount12         robert    | john    | brown    | 100     | 20 ...more data 

the thing structure login process need fire each iteration. if that's not liking use where: block , move given: block out setupspec() fixture method.


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -