loops - Spock: How to use test data with @Stepwise -
i used @stepwise automation. 8 test methods running sequentially complete process. 1 of methods take parameter , want pass different parameters method.
but problem is: method takes first set of parameter, parameters processed and instead of proceeding next method, method takes next set of parameter.
the source looks like:
@stepwise class aosearchpagetest extends gebreportingspec { def "first_method"() { } def "second_method"() { when: @ particularpage then: process(area) process(coutntry) process(airport) process(dest_area) process(dest_coutntry) process(dest_airport) where: area << ["asia","europe"] country << ["japan","uk"] port << ["narita","london"] dest_area << ["asia","europe"] dest_country << ["korea","italy"] dest_port << ["seul","florence"] } def "third_method"() { //some other processing }
the second method first populate "asia","japan","narita","asia","korea","seul"
and instead of executing "third_method"(), takes second set of parameter europe,uk,london,europe,italy,florence.
how can process each set of data methods [defs] executed top bottom each set of data?
first of all, @stepwise
indicates spec's feature methods should run sequentially in declared order (even in presence of parallel spec runner), starting first method. if method fails, remaining methods skipped. feature methods declared in super- , subspecs not affected.
where
clause indicates how many times method executed. can't go 1 method without finishing it's full execution. so, u can move dependents tasks 1 method , move processing in helper method reduce line of code in spec method.
Comments
Post a Comment