Forum Discussion

mamar's avatar
mamar
Contributor
12 years ago

[Resolved] How to run a static request dynamically?

Hi,
I have a test case which has a test request and groovy step like below.

Test Suite 1
---Test Step 1
---Groovy Script 1

My test case will run by fetching data from excel (data driven testing), runs the Test Step 1 and Groovy Step 1 and will continue to loop for 30 rows (30 scenarios). But for the 15th test case from the excel, first i need to run an another request (just need to pass the input to that request) and then my Test Step 1 should be run and this scenario is only for this 15th test case in my excel.
To be more clear, i want to run a series of test input with an test request, but for one case alone, i need to run a another request before running this and then followed with the current request.

Please can any one help me on this.

2 Replies

  • Hello,
    What I understand is that you want to execute following steps:
    1) Data source
    2) Test step1
    3) Groovy1
    4) Data source loop

    And are expecting something like:
    1) Data source
    2) Groovy - to decide to test step1 or step2
    3) Test step1
    4) Groovy - to skip test step2 and go to Groovy1 as either test step1 is required or test step2
    5) Test step2
    6) Groovy1
    4) Data source loop

    You can achieve step 2) by using something like below script:

    def var= 'get variable value from data source for which toggling is needed'
    if(var == 'expected value to run step1')
    {
    myGotoStepName = 'Test Step1'
    testRunner.gotoStepByName( myGotoStepName )
    }
    else
    {
    myGotoStepName = 'Test Step2'
    testRunner.gotoStepByName( myGotoStepName )
    }

    And on similar lines you can built groovy for step 4)

    Hope it may help...
  • That works for me. Thanks for your help and time.