Call an application running on remote server through command line
I have an application that runs on my test server through command line. Is there a way I can call that application from SoapUi open source installed on my local machine.
Thanks in advance.
Solved! Go to Solution.
Hi @gurpreet31 ,
That is possible under certain circumstances. What OS do you use and what OS does the test server use?
In order to execute a command you need to create a text file that contains the command. This file must be on the same machine as the SoapUI application. You also need to have Putty on the same machine. Then you create a groovy script step and you can execute the command as:
'cmd /c D:\\applications\\putty\\putty.exe -ssh yourserver -l yourusername -pw yourpassword -m D:\\applications\\putty\\commands.txt'.execute()
SoapUI can execute cmd commands through groovy scripts. Luckily, putty can be ran from cmd. 🙂
Follow the following steps to be able to run commands from SoapUI in Linux machines:
1. Copy Putty on the same machine as SoapUI.
2. Again, on the same machine as SoapUI create text files containing your commands. Normally you can put multiple commands in the same file when working with Linux but I can't guarantee that. You will need to try it yourself.
3. Open your SoapUI project and add a step of type Groovy script. The synthax for executing a cmd command is:
'cmd /c DUMMYCOMMAND'.execute()
4. The command for running putty is:
putty.exe -ssh hostname -l yourusername -pw yourpassword -m fileFromWhichToExecuteCommands
5. From points 3 and 5 we get then:
'cmd /c putty.exe -ssh hostname -l yourusername -pw yourpassword -m fileFromWhichToExecuteCommands'.execute()
6. Please note that when using putty.exe you also need to specify the path to it. So this would look like
'cmd /c D:\\applications\\putty\\putty.exe...
The same goes for the file containing your commands.
7. If you don't want to worry about point 6, you can always add putty to your Windows path.
1. If you commit this project in git like this, you will also commit the username and password there, which is a bad practice.
2. Changing properties and restarting servers will increase your test duration. On the long run, it might be useful to find other solutions for this. (like putting property changes in the unit tests instead)
haha sure 😄 glad I could help.