Access logs on server (PUTTY) from SOAPUI

I have to create one SOAPUI test case.

This test case is named: "Login in the app with OTP (one time password)".

  1. At first I send POST request.
  2. Then server generates OTP and send it to the phone number.
  3. Now, I need to connect to the server (PUTTY) and find a log, where the OTP is saved.
  4. Then I need to insert the OTP to the next POST request.

I created simple Groovy script as SOAPUI test step, which opens connection in PUTTY.

def command = "C:/path/to/putty.exe -ssh user@IP -pw pass"
def proc = command.execute()

Then I need to write some commands in PUTTY and get OTP variable from log file.

But I don´t know how to execute the commands via Groovy script.

Can anyone help me, please. Thank you

1 answer

  • answered 2018-11-06 09:36 Eric Darchis

    You should use -m in the putty command line. This .sh file would contain the list of commands to run to extract the information you want on the server.

    To process the output of the command, you can use:

    proc.consumeProcessOutput(sout, serr)

    sout would contain the standard output of the command, extracting the info you actually need should be pretty straightforward.