Configure Web-server via SSH prior to running test cases


#1

I have web application testing which I am able to automate with Katalon. However, the server should be configured via SSH CLI prior to each test suite (i.e. set a configurable parameter which dictates how the web app reacts to test interactions).

Is it possible to SSH to the web server, issue a CLI command and gain the response prior to executing a test case (or Suite)?

Examples or pointers to documentation would be gratefully received!


#2

Colin Bowdery said:

I have web application testing which I am able to automate with Katalon. However, the server should be configured via SSH CLI prior to each test suite (i.e. set a configurable parameter which dictates how the web app reacts to test interactions).

Is it possible to SSH to the web server, issue a CLI command and gain the response prior to executing a test case (or Suite)?

Examples or pointers to documentation would be gratefully received!

SSH is totally different to web automation, make a bash script that does your SSH stuff for you and then calls the Katalon script once it is complete or you could even call the bash script to do your SSH stuff from a test case.

Something like this should do the trick, pipe your commands to SSH

cat your_commands_script.sh | remoteuser@ip.address.of.remote.machine
Run the shell commands from the test case by adding something like this in the scripting mode.Not sure if it will need any imports so just press CTRL +SHIFT + O to sort your imports out incase ;)Runtime.getRuntime().exec('cat your_commands_script.sh | remoteuser@ip.address.of.remote.machine')
Have to figure out some wizardy for confirmation your SSH command was successful, perhaps write back to a text file on the original server, which you test case checks before it continues. Or just delay a set amount of time if the command doesn't fail...

Relevant links
https://www.mkyong.com/java/how-to-execute-shell-command-from-java/https://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html

#3

Is it possible to use external Java SSH library and create a custom keyword to send SSH command? Thanks.