mardi 30 août 2016

Spock: How to use test data with @Stepwise

I used @Stepwise for automation. 8 test methods are running sequentially to complete the process. One of the methods take parameter and I want to pass multiple combinations of parameters to the method.

But the problem happening is: For the first set of parameter, the variables are populated with those parameters and processed AND instead of proceeding to the next method, the next set of parameter is populated instantly.

The source looks like:

@Stepwise
class AOSearchPageTest extends GebReportingSpec
{
    def "first_method"()
    {
    }

    def "second_method"()
    {
        when:
        at particularPage
        then:
        process(area)
        process(coutntry)
        process(airport)
        process(dest_area)
        process(dest_coutntry)
        process(dest_airport)

        where:
        area << ["アジア","ヨーロッパ"]
        country << ["日本","イギリス"]
        port << ["東京(成田・羽田)","ロンドン"]
        dest_area << ["アジア","ヨーロッパ"]
        dest_country << ["韓国","イタリア"]
        dest_port << ["ソウル","フィレンツェ"]
    }

    def "third_method"()
    {
        //Some other processing
    }

The second method first populate with the "アジア","日本","東京(成田・羽田)","アジア","韓国","ソウル" and then instantly populates with the second set.

How I can process each data set with complete life-cycle?

Aucun commentaire:

Enregistrer un commentaire