Forum Discussion

sentrt86's avatar
Occasional Contributor
2 years ago

Create the readyApi project and run the ready api project from Azure pipeline

Here is the requirement. 

  1. we are creating the API through our automation process of Azure pipeline, currently we are creating the ready api project using the readyApi based on Yaml file. Also we manually add the Oauth Token creation process(Through HTTP request step) for Authenticating the api request coming into APIM.
  2. Now we want this to automate the process of creating the ready api project for each api we are implementing on our APIM portal and add the HTTP request step to get the Oauth Token and run the ready api project file through azure pipeline. In simple create and run the readyApi file through azure pipeline itself.

4 Replies

  • KarelHusa's avatar
    Champion Level 2


    your request is feasible. You can make a Java/Groovy program which will generate the ReadyAPI project from OpenAPI definition (e.g., in YAML format) and create a test case, starting with the authentication.


    Though, the main strength of ReadyAPI, which is in my opinion the efficient user interface to create and manage tests


    Also, creating proper test data could be a challenge. Of course you can generate them from the examples from OpenAPI definition, but that would require well-designed APIs. Or, you can make your own test data generator.


    I have done a similar thing (generating test projects) in the past in SoapUI, but used the test data from the prepared files, not generating them on the fly.


  • sentrt86's avatar
    Occasional Contributor

    Can you please share the snippet of how you did? thanks for your response.

    • KarelHusa's avatar
      Champion Level 2


      I am sharing a Groovy snippet, see bellow.


      The principle is:

      • Take SoapUI/ReadyAPI libraries (see imports)
      • Follow the same approach you would use with ReadyAPI user interface, i.e., create a project, create test suite, create test case, add test step, set assertions.


      The snippet only illustrates the principles, but cannot be executed as is, since it is extracted from a larger project.


      import com.eviware.soapui.impl.WsdlInterfaceFactory
      import com.eviware.soapui.impl.wsdl.WsdlInterface
      import com.eviware.soapui.impl.wsdl.WsdlProject
      import com.eviware.soapui.impl.wsdl.WsdlTestSuite
      import com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase
      import com.eviware.soapui.model.project.Project
      import groovy.xml.*
      List services = getServices()
      def projectName = "SharedServices-GeneratedTests"
      def project = new WsdlProject()
      services.each {
          def service = it
          WsdlInterface[] interfaces = WsdlInterfaceFactory.importWsdl(project, getServiceWSDL(service), true)[0]
          WsdlTestSuite suite = project.addNewTestSuite(service)
      	WsdlTestCase tc = suite.addNewTestCase("BasicTest")
          WsdlGroovyScriptTestStep gs = tc.addTestStep(GroovyScriptStepFactory.GROOVY_TYPE, 'SetRequestId')
          gs.setScript('testRunner.getTestCase().setPropertyValue("RequestId", UUID.randomUUID().toString())')
      	WsdlTestRequestStep step = ServiceTest.createTestStep(interfaces[0], tc, 'StandardRequest', getServiceRequest(service))
          step.addAssertion('Not SOAP Fault')
          step.addAssertion('Schema Compliance')