Forum Discussion

mtarullo's avatar
mtarullo
Occasional Contributor
7 years ago

Open Source SoapUI 5.4.0 Documentation

Is the only "documentation" for SoapUI Open Source 5.4.0 the on-line documentation you get to from the Help menu?

 

If so, this is woefully lacking.  There are many features that are not explained.

 

For instance, how do you use the Dispatch feature for the response of a mock REST service?

 

The existing documentation states that sequence uses the listed responses in sequence and script allows you to make responses dynamic, but there is no explanation how this is done.

  • JHunt's avatar
    JHunt
    Community Hero

    There's plenty of documentation online.

     

    https://www.soapui.org/getting-started/introduction.html

    https://support.smartbear.com/readyapi/docs/soapui/tutorial/index.html

    https://www.soapui.org/apidocs/overview-summary.html

     

    Plus for REST MockServices it gives you this little spiel as soon as you select SCRIPT for dispatch method. But not for SOAP for some reason.

     

    /*
    // Script dispatcher is used to select a response based on the incoming request.
    // Here are few examples showing how to match based on path, query param, header and body
    
    // Match based on path
    def requestPath = mockRequest.getPath()
    log.info "Path: "+ requestPath
    
    if( requestPath.contains("json") )
    {
        // return the name of the response you want to dispatch
        return "JSON Response"
    }
    
    
    // Match based on query parameter
    def queryString = mockRequest.getRequest().getQueryString()
    log.info "QueryString: " + queryString
    
    if( queryString.contains("stockholm") )
    {
        // return the name of the response you want to dispatch
        return "Response Stockholm"
    }
    else if( queryString.contains("london") )
    {
        // return the name of the response you want to dispatch
        return "Response London"
    }
    
    
    // Match based on header
    def acceptEncodingHeaderList = mockRequest.getRequestHeaders().get("Accept-Encoding")
    log.info "AcceptEncoding Header List: " + acceptEncodingHeaderList
    
    if( acceptEncodingHeaderList.contains("gzip,deflate") )
    {
        // return the name of the response you want to dispatch
        return "GZiped Response"
    }
    
    
    // Match based on body
    def requestBody = mockRequest.getRequestContent()
    log.info "Request body: " + requestBody
    
    if( requestBody.contains("some data") )
    {
        // return the name of the response you want to dispatch
        return "Response N"
    }
    */
    • mtarullo's avatar
      mtarullo
      Occasional Contributor

      Thank you!

       

      Right after I posted this I found the sample script and it was very helpful.  I was able to do what I needed to do.

       

      But I must disagree about the documentation; not the availability but the quality.  For instance, from the example you determine that you need to make a call to the mockRequest object.  The API shows the methods of the object, but the API is extensive.  Where is the documentation to find out how to use it to do something else that is not provided in a example script?

       

      In this same context, I find the documentation for both the exporting of a mock REST service to a WAR file lacking as well as DETAILED information about how to run a test case using the mock REST service WAR in an automated command line environment.  In my opinion, just stating that you can create a WAR file is not good documentation.  Yes it's important to state this so one knows the feature is available, but good documentation would show how to do this and explain why one is doing what one does!  For example it would be extremely helpful to have an explanation of what the WAR file will contain since it appears you have to export the whole project, but the only thing you really want tin the WAR file is the mock REST service.  Is this or should it be a concern?  If yes, why.  If not, why.