Forum Discussion

NisHera's avatar
NisHera
Valued Contributor
8 years ago

Can Swagger generate rest testing frame?

We have a rest api service which I have to automated regression test.

I started with TestComplete incorporating python request library.

The problem is have to write everything from scratch. ...  one by one.

I refereed swagger code gen documents ..rather confusing and it's aimed for basically developers, not testers  

is it possible swagger code gen to generate test frame......... I mean skeleton code for rest callings

any help would be appreciate...

7 Replies

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    Hi NisHera,

     

    TestComplete is for GUI testing. API testing is done using SoapUI (free, open-source) or Ready! API (commercial version). They both include the Swagger plugin that lets you create a test project from a Swagger definition. Once you imported your Swagger definition, you can generate a test suite.

     

    Quick steps:

    • Create an empty project in SoapUI (use version 5.3.0) or Ready! API.
    • Right-click the project and select Import Swagger. You can import both local files and URLs.


    • Right-click your API name and select Generate TestSuite. Select the endpoints to add to the test.


    • You'll get a test suite like this:
    • Review the generated test steps: change the request bodies, add assertions for response contents, etc.

    Hope this helps!

    • NisHera's avatar
      NisHera
      Valued Contributor

      Thanks for reply HKosova

      I try it but when generating test suit if dose not created parameters (eg in post methods you need to put parameters ) which are already defined in swagger.

      I think this questing also same..

      is there any solution for that?

      • HKosova's avatar
        HKosova
        SmartBear Alumni (Retired)

        Hi NisHera,

         

        The plugin version included in the open-source SoapUI does not generate request bodies, you need to enter them manually. If you use Swagger UI, you can copy body examples from there.