Forum Discussion

ENZO's avatar
ENZO
New Contributor
8 years ago

Howto auto generate requests from the data which is delivered by a REST response?

Hi all

I was wondering if it is possible to auto generate or at least kind of semi automatically generate GET requests from the data that is delivered by a kind of GET "walk" at root level.

I need to generate hundreds of GET requests for a REST API and I would like to know if there is a way around it to manually enter all of them into SOAPUI?

When I use a GET request at root level ( http://localhost:12345/*) then I get all the labels I need in the response, but I did not find a feature yet to use them to create a GET request for every single one of them.

Even the REST Discovery tool does not help me as it only generates one single request (the root request I used to get all the labels).

What I am looking for is a feature where I can select all the labels I need and the GET requests will be generated automatically or even better a feature that would generate GET requests for all the labels contained in the "root request" and I would only need to delete the one I don't need.

 

Is there such a feature at all?

I just upgraded to the SOAPUI PRO Trial version as I did not find such a feature in the open source version.

Can anybody point me in the right direction?

That would be much appreciated.

Cheers

Enzo

7 Replies

  • Radford's avatar
    Radford
    Super Contributor

    Have you investigated the Data-Driven Testing functionality of Ready API?

     

    You can use a data source test step to loop through sets of data from various sources,  but I guess the ones that will of be of interest to you will be either the XML or JSON, as with these you can specify a preceding step to be the source.

    • ENZO's avatar
      ENZO
      New Contributor

      Hi Radford

      Thanks for your reply.

      I have already looked into the Data Driven Testing and I know technically this could do the trick.

      The problem is for documentation reasons I need to be able to import these test cases into Silk Central.

      As the import template for Silk Central is very basic I don't see a proper way to import such a complex data driven test into it.

      Therefore I need seperate test cases for each and every label I am afraid.

      Cheers

      Enzo

       

      • Radford's avatar
        Radford
        Super Contributor

        I think that possibly you may be able to craft a solution in Groovy script to do what you want, the JavaDocs can be found here. Though to be honest, it does sound very complex, not something I would want to attempt.

         

        When you say you need to "import these test cases" do you mean you need to import the entire ReadyAPI test case project file, or just the request and response of your REST service being tested?

         

         

  • nmrao's avatar
    nmrao
    Champion Level 3

    What do you mean by the statement? - "When I use a GET request at root level ( http://localhost:12345/*) then I get all the labels I need in the response"

     

    Please clarify if the below is the summary of your question -

    • there is a method / endpoint to test
    • the data required to test the above method in the form of a table / csv / excel i.e., be able to use it for data driven test
    • you wish to create requests separately instead of data driven
    • the requests might have lot elements, some mandatory and some optional. should be flexible to create requests with such optional elements.

     

    Questions:

    • You mentioned in other threads that you are using silk central. Is it mandatory that you need to maintain those there?
    • Does it allow you to have a soapui project?
    • Or do you just need only requests? In this case, how would you want to test them later?

     

    Other Inputs:

    • If tests are to be automated, then at some point user needs to have dealt with different kinds of data / transforming where some kind of programming would be handy and just like developing of some software. Otherwise, automation will stuck and will not have smooth path further.
    • It does not matter despite having sophisticated automation tools.

     

    For now, if you want to just generate requests for your data, without too much efforts is to use data-driven test for your data and use Events feature to save those requests while you test as you needed for other purpose (in this case Silk Central).

     

    If the above point is not useful i.e., you do not want to execute the tests from your data just to generate the requests, then in my opinion, you do not even require SOAPUI, and use a programming language of your choice to generate desired requests straight from the data. May be this way, you should be able to get some help from your developers, hopefully.

    • ENZO's avatar
      ENZO
      New Contributor

      Hi Rao

      Let me try to rephrase what I am looking for.

      As Silk Central is not able to import complex test cases I need seperate test cases for every request.

      I will not be able to import a data driven test case into Silk Central as there are too many elements included and Silk Central does not seem to be able to handle them. So far I was only able to import very simple test cases by exporting them as xml and to manually transfer them into an Excel format using the xml mapping feature of Excel.

      As I am new to Silk Central as I am to SOAPUI I am looking into my options how to integrate SOAPUI automated tests into Silk Central. Silk Central will remain our primary test management tool.

      The SOAPUI web site tells me that Silk Central is not supported as a product but of course there will be other more general ways to re-use data in Silk Central generated with SOAPUI.

       

      When working with SOAPUI I noticed that I can get all the resources configured when using a GET request with the asteriks wildcard on our REST api.

      This request will get me something like thisin XML notification:

      <Response>
         <e>
            <Label>HEALTH</Label>
            <Value>
               <e>
                  <Label>HEALTH.QMIModemModule</Label>
                  <Value>
                     <e>
                        <Label>HEALTH.QMIModemModule.MODULESTATUS</Label>
                        <Value>Running</Value>
                     </e>
                     <e>
                        <Label>HEALTH.QMIModemModule.SEVERITY</Label>
                        <Value>Warning</Value>
                     </e>
                     <e>
                        <Label>HEALTH.QMIModemModule.RESET</Label>
                        <Value>0</Value>
                     </e>

       

      To be able to import these test cases into Silk Central I would need a single test case for every label/value pair.

      I was hoping that SOAPUI would offer such a feature to auto generate test cases for all the label/value pairs out of the box, which does not seem to be the case.

      To avoid entering the test cases manually in Silk Central and SOAPUI I was hoping to spare me the hassle to make use of such an auto generation feature and simple export/import these test cases into Silk Central.

       

      As the next step I want to import the test results of SOAPUI into Silk Central but I already struggle to generate test reports that are detailed enough. I am afraid this has something to do that the reports seem to be centred around parameters and we only use resources.

       

      Regarding your questions:

      - Yes, there is a REST API endpoint to test

      - According to the Silk Central website there is no support for SOAPUI at all

      but only these:

      Integrated third-party software
      • Bugzilla 4.4.6
      • IBM Doors 9.5 & 9.6
      • IBM Rational ClearQuest 2003.06.15.734
      • IBM Rational Requisite Pro 7.1.3, 7.1.4
      • JIRA 5 & 6
      • JIRA Agile 6
      • JUnit 4.11 or later
       Support
      • Microsoft Office Excel (.xlsx)
      • Microsoft Office Word (.doc, docx)
      • Rally
      • SAP Solution Manager 7.1
      • Subversion 1.8.5
      • Team Foundation Server 2010, 2012,2013
      • VersionOne
      • VMware vCloud Director 5.5

      - Ideally I would have SOAPUI projects in Silk Central but this is not supported so I need to make the best out of the options to import data from SOAPUI. Silk Central is the central system where all the data should be available. The (auto) tests itself would be done in SOAPUI.

       

      I will have a look at the Events feature you are talking about.

      Thanks for your help.

       

      Cheers

      Enzo