Forum Discussion

automatoramit's avatar
automatoramit
Occasional Contributor
9 years ago

Common Request Headers (Header Manager) for All the Requests in a Test Suite?

Hello, 

 

Is there any way in SoapUI by which I can create a common request header and that will be shared by all the requests in a Test Suite?

 

In a project (REST API) which I am working on, I need to send "Authorization" for every single request. It is a tadious task, specially when you are working with too many requests in the test suite. 

 

So is there any way to avoid this? 

 

Thanks

4 Replies

  • rupert_anderson's avatar
    rupert_anderson
    Valued Contributor

    Hi,

     

    I can't help but feel there is a simpler / less technical way of achieving this, but one way to do this in SoapUI by creating a RequestFilter.filterRequest - see examples:

     

    http://www.soapui.org/scripting---properties/tips---tricks.html (point 5.2, not exactly what you need, but shows how the request or in your case, all requests could be modified/added to across the field)

     

    In the open source version adding this code involves writing a plugin, not as hard as it may sound, but something I would need to explain separately (or in SoapUI Cookbook, chapter 11 has a recipes on this and a RequestFilter example). In SoapUI Pro, the adding of this code to a RequestFilter is made easier using a custom event handler:

     

    http://www.soapui.org/scripting---properties/custom-event-handlers.html

     

    This is easier upfront i.e. no plugin, but same idea.

     

    I also wonder if there is a quick Groovy script that could be run to select and update all request in a given TestSuite - again, sorry its not a quick answer, but doable with some effort.

     

    Hopefully someone else can jump in with a nice quick answer for you or a simple work around e.g. using the 'Clone TestStep' functionality to copy arround a already edited TestStep. 

     

    Hope this helps, 

     

    Cheers,

    Rupert

     

     

    • automatoramit's avatar
      automatoramit
      Occasional Contributor

      Hi, 

       

      Thanks for your reply. 

      I am using open source version of SoapUI so I will go for Plugin option. 

      • rupert_anderson's avatar
        rupert_anderson
        Valued Contributor

        Hi,

         

        Nice one - if you need any help / tips regarding the plugin part please let me know

         

        Cheers,

        Rup