Forum Discussion

kunalmalviya's avatar
kunalmalviya
Occasional Contributor
8 years ago
Solved

Execute test cases from excel based on Yes/No flag?

First step in my test cases is a excel data source which has different combination of parameters that get supplied to my REST request. I want to execute my test only for those rows which are marked as "Yes" in excel. How do I do that?

 

I have tried conditional goto and property transfer but that doesn't help.

  • JKambli's avatar
    JKambli
    8 years ago

    Add a groovy script after DataSource

     

    Right click > Get Data> DataSource > Execute

     

    if (valueOfExecute == 'Yes'){

    testRunner.gotoStepByName( "next step name")

    }

    else

    {

    testRunner.gotoStepByName( "DataSource Loop")

    }

     

    Thanks

6 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    The available information is not enough to provide any help.

    The topic summary and description do not connect as one talks about test cases and another talks about steps.
    • kunalmalviya's avatar
      kunalmalviya
      Occasional Contributor

      Sorry for the confusion.

       

      Here is how my structure looks in SoapUI

       

      --TestSuite

           - TestCase1

               - TestStep1 (Excel datasource)

               - TestStep2 (REST Request)

               - TestStep3 (DataSource Loop)

       

      In my 1st step the data from excel looks like this where zip and sessionid gets passed to REST request

       

      Execute |   Zip    | SessionID

         Yes     | 12345  |  1

          Yes    |  42156 |  2

          No     |  25478 |  3

       

      Now I only want to pass these parameters when the flag is set to "Yes" or else Skip.

      • JKambli's avatar
        JKambli
        Staff

        Add a groovy script after DataSource

         

        Right click > Get Data> DataSource > Execute

         

        if (valueOfExecute == 'Yes'){

        testRunner.gotoStepByName( "next step name")

        }

        else

        {

        testRunner.gotoStepByName( "DataSource Loop")

        }

         

        Thanks