I need to execute unix command/shell script on unix system by SoapUI tool. SoapUI is installed on windows machine.
- How to make ssh connection by SoapUI to unix machine?
- How to run the command?
- How to capture the output of this command?
I need to execute unix command/shell script on unix system by SoapUI tool. SoapUI is installed on windows machine.
You can use the folowing code:
def process = 'ssh user@host myCommand'.execute()
process.waitFor()
println process.in.text
println process.err.text
You can execute it as a testSuite or testCase setUp/tearDown script, script test step or any other place where groovy can be executed.
If that is possible, I recommend to configure the authentication with keys, so that you will not be asked for a password when making a connection.
You can also execute multiple commands within a single connection:
def process = 'ssh user@host "myCommand1; myCommand2; myCommand3"'.execute()
I prefer using the && operator to execute the command only if the previous finished successfuly, i.e.:
ssh user@host "myCommand1 && myCommand2 && myCommand3"