Forum Discussion

678's avatar
678
Regular Contributor
6 years ago

Reusable REST Requests

I have a scenarios where i need to call some Frequently use REST Requests in other test cases 

 

How can i setup this , i am using READYAPI

 

 

10 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    It is good practice that each test case is independent.
    Can you elaborate your use case please?
    • 678's avatar
      678
      Regular Contributor

      sample use case 

       

      Project 1

        Test Suite 1(Common)

           Login In - Test Case (Rest Request)

           Logout - Test Case (Rest Request)

       

      Test Suite 2 (Actual Test cases) 

          

           Test Case (Add User - Rest Request) (Pre-Requisite need to run above Login Request) then test case (adduser) and                         Logout Request 

           Test Case (Delete User - Rest Request) (Same like above) 

       

       

      • richie's avatar
        richie
        Community Hero

        Hi,

         

        erm - I don't know if I'm looking at the question from the wrong perspective - but it's reminding me of a question one of my colleagues asked me.

         

        They were looking at setting up SoapUI using their experience of setting up a front end automation frameworks - e.g. modular/test library automation framework where you have lots of 'scripts' doing actions/navigation through an application which then makes up a larger testcase.  Are you considering your question from a similar perspective?

         

        Someone's bound to know more than me - but as far as I can tell, SoapUI doesn't really lend itself to modularizing a test case built from other testscripts like this.  Just because you need a login (and perhaps a logout request) to enable you to exercise the other apis for your tests - you'll just end up wrapping the test case requests testing the other api's with the login and logout request.  What I mean by this is if you had a 'search' and 'buy' api to test you'd just create a test case like the following hierarchy

         

        Login REST Request
        Search REST Request
        Buy REST Request
        Logout REST Request

        OR - have I totally gone off on one and totally misinterpreted your question? :)

         

        There are a couple of Sample SoapUI projects available with SoapUI.  These have something similar to above that I mentioned.

         

        Cheers,

         

        richie