Forum Discussion

emile's avatar
emile
Occasional Contributor
10 years ago
Solved

set header in teststep by loop

Hi, I'd like to set all my teststep Hedears by looping, something like that :   def testSteps = context.testCase.getTestStepList() testSteps.each{ // This block will loop through the test steps ...
  • NBorovykh's avatar
    10 years ago

    Hello Emile,

     

    I would simplify your code by using the "it" keyword withing the loop for referring to the current TestStep:

    def testSteps = context.testCase.getTestStepList()
    testSteps.each{
    try{
      it.testRequest.setRequestHeaders(headers);
    }
    catch (e){}
    }