Forum Discussion

Pritish_Panda's avatar
Pritish_Panda
Contributor
9 years ago

How to get an information from Remote Server and use it in soapUI.

Hi,          Is there any way that I can fetch a file path from remote server and the same file path will be used in my SoapUI rest Project    Thanks  Pritish Panda
  • nmrao's avatar
    nmrao
    9 years ago

    Here you go:

     

    /**
    * edit and write your command below
    */
    def command = "you batch script command"
    log.info command
    def process = command.execute()
    def outputStream = new StringBuffer()
    def errorStream = new StringBuffer()
    process.consumeProcessOutput(outputStream, errorStream)
    process.waitFor()
    log.info("return code: ${process.exitValue()}")
    log.error("standard error: ${process.err.text}")
    log.info("standard out: ${process.in.text}" + outStream.toString())
    context.testCase.setPropertyValue("propertyName", outStream.toString())

    The output of batch script is now set into test case level proprty called "propertyName". And use property expansion i.e., ${#TestCase#propertyName} where it is needed.