Forum Discussion

emile's avatar
emile
Occasional Contributor
8 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
    8 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){}
    }