Forum Discussion

Pritish_Panda's avatar
Pritish_Panda
Contributor
9 years ago
Solved

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.

14 Replies

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Pritish,

     

    Could you please clarify your request? What remote file do you want to get? What do you mean by a remote server?

    • Pritish_Panda's avatar
      Pritish_Panda
      Contributor

      Hi Tanya,

       

        Actually I have a file in my Linux server / HDFS (Remote location) & I would like to featch the file path from linux server .

      So I am able to fetch the file path by using a ShellScript.  Same file path I would like to use in my RestStep in SoapUI .

       

      Is there any way that I can pass that value to SoapUI So that can be used in my RestStep ?

       

       

       

      Thanks 

      Pritish Panda

       

       

       

      • nmrao's avatar
        nmrao
        Champion Level 3
        Do you mean download using ftp/scp to local machine?
        By the way, if you can get the file path using shell script, you download it using the same. Isn't it?