How to create platform independent ssh connection?
Hi, newbie SOAtest user here.
We are in the process of evaluating SOAtest, and one of the requirements is that our test suites can run both on Windows and Linux. Since both also need to ssh into a Linux box to run commands, the external tool seems out of the question, because it will require PLink on Windows and ssh on Linux. When I read the forums it has been suggested to use the FTP client which can do SSH/SFTP commands. But I can't find how to run a command other than the standard SFTP commands pwd, ls, cd, mkdir, rmdir, get, put. Nothing to run a local Linux command. Has anyone found a solution for this type of scenario?
Best Answer
-
Portability is definitely a good thing. This is true whether designing code or designing test cases (Parasoft or otherwise). I can imagine taking one of the following approaches here:
"ssh" is available for Windows as part of Cygwin. So, it is possible to run "ssh" with the exact same arguments in such a way that would work on both Linux and Windows.
If instead you need to run entirely different commands on Linux vs Windows, then you could parameterize the path and any arguments with variables. This way you could use different values for those variables to run a different command or script depending on the environment. See Running Tests in Different Environments.
You can also consider having two different External Tools, one with the Linux command configured and a second one with the Windows command configured. You can use test flow logic to conditionally execute one vs the other based on a test suite variable.
Lastly, you could use some java-based ssh tool that is not OS specific. Perhaps you could make your External Tool call an Apache Ant script that uses the sshexec task. Or maybe you use an Extension Tool and write a little script using the jsch java library.
5
Answers
-
Thanks. That really helps pointing us in the right direction!
0