Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

SSH Connection

Options
LegacyForum
LegacyForum Posts: 1,664 ✭✭
edited December 2016 in SOAtest
SSH
Dear All,

I would appreciate it if you could share your knowledge regarding ssh connectivity:
I am running a SOAP client in my suite (windows pc) and the server is running on
a linux pc inside the network. I would like to connect to the linux (via soaTest) system,
execute a command (for example "ls -la /home/lefteris") and if this command returns
I would like to execute the soap client.

Is it possible to connect via scripting at the linux system using ssh connection? Any ideas?

Thanks and regards from Athens.
Lefteris
Tagged:

Comments

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Options
    You can use our Method tool to implement an appropriate script that can establish an ssh connection to your linux machine.

    As for setting up your overall scenario, your test suite structure should look like the following,

    CODE
    Test Suite: Test Suite
      Test Suite: Scenario 1
        Method Tool
        SOAP Client

    and you'll need to do the following,

    1. Add a TestSuiteVariable (e.g. a boolean variable)
    i. Click on the parent test suite that contains the Method Tool and SOAP Client
    ii. Select Execution Options tab followed by Test Variables tab
    iii. Add a variable by clicking the Add button


    2. Implement Method tool
    i. Add the appropriate script that allows you to ssh connect to your linux machine followed by executing the desired command
    ii. Extend the script by adding logic for it to retrieve the TestSuiteVariable created in step 1 (see our Scripting API by going to Help > Scripting API in SOAtest GUI)
    iii. Further extend the script to set the value of the TestSuiteVariable. For example, if the command succeeded, then set the value to true or false if it failed (assuming you created a boolean variable)

    3. Configure Test Logic Dependency
    i. Click on the parent test suite that contains the Method Tool and SOAP Client
    ii. Select Execution Options tab followed by Test Flow Logic tab
    iii. Select SOAP Client in the "mini-tree" under Execution Options tab
    iv. Under Variable Condition select the variable added in step 1, and select radio button "true".


    To sum it up:

    The Method tool executes the script which connects to your linux machine and executes a command. If the command is successful, you toggle the boolean variable to true, else you set it to false. The test flow logic configured in step 3 will determine if the SOAP Client will be executed based on the value of the boolean variable.

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    edited January 2009
    Options
    Fantastic. It took me some time to create jython code that connects via ssh,
    however the logic of the script is based on your description and works perfectly
    and fast.

    Euxaristw (means thanks in Greek).
    Lefteris.
  • hemadrid
    hemadrid Posts: 1
    Options

    Can someone share a reference implementation for this

  • benken_parasoft
    benken_parasoft Posts: 1,230 ✭✭✭
    Options

    Use the built-in FTP Client tool which supports executing remote commands via SSH/SFTP. There is also a custom tool on https://marketplace.parasoft.com/ named "SFTP Client Tool". The tools are almost doing the same thing under-the-hood with one notable difference:
    "This tool differs from the SFTP support in the builtin FTP Tool in that it supports authentication using SSH keys instead of passwords."