Forum Discussion

QATest's avatar
8 years ago

Update headers to multiple test steps

Is there a way to add multiple headers to test case level rather than each individual test step level?

2 Replies

  • nmrao's avatar
    Champion Level 3

    Thank you rupert_anderson for pointing the script.

    QATest, it is little confusing when you say "multiple headers to test case level". Because, headers are applicable only to the test steps that uses http transport protocol.

    Did you try the script pointed by Rupert earlier?

    If you have different requirement, please elaborate the question.


    I am assuming that you have multiple test steps (soap / rest / http  request ) and you want those headers to all steps of that test case? 


    Then you can add the script into Setup Script of the test case with minor modification of the earlier pointed script.


    Here is the modified script, you can change the headers as needed.

  • rupert_anderson's avatar
    Valued Contributor



    Do you mean for a given TestCase, you want to add a set of headers to each request TestStep within it automatically?


    If so, I noticed nmrao wrote a nice script to automatically add headers at a TestStep level:



    This could be adapted to iterate over all TestSteps in a TestCase - Rao do you already have a script like this?


    You can also add request filters to automatically add headers when requests are despatched, but this is generally a more complex process. Can explain more about this if necessary.