Service Virtualization

  • 1.  How to read SSH step out put and store the value into a variable?

    Broadcom Employee
    Posted Nov 21, 2017 12:04 PM

    Hi,

     

    I have a ssh step that gives following output:

     

    versionId: 3058290

    source: test_javaxvul1

    url: javaxurl

    description: javaxdesc

    score: 0.0

    severity: high

    Sucessfully created.-922

     

    How to read SSH step out put and store the value into a variable?



  • 2.  Re: How to read SSH step out put and store the value into a variable?

    Broadcom Employee
    Posted Nov 21, 2017 10:48 PM

    Hi,


    If you only pushed the button named "Test SSH Command" and got the output at the GUI for SSH Step, then you can copy the output result from the GUI.

     

    But if you ran the test case, then the output results for the steps(not only SSH step) are stored to the property {{lisa.<Step Name> Step.rsp}}.
    So if you want to save this property to a file, then you should add the filter named "Save Property Value to File" to the SSH Step then you can save the whole output of this step.
    Or you can store this value to a property which has a different name.

     

    Cheers,



  • 3.  Re: How to read SSH step out put and store the value into a variable?

    Broadcom Employee
    Posted Nov 22, 2017 01:19 AM

    I want to save -922 from the below response into a variable

     

    versionId: 3058290

    source: test_javaxvul1

    url: javaxurl

    description: javaxdesc

    score: 0.0

    severity: high

    Sucessfully created.-922

     

    How can I do that?



  • 4.  Re: How to read SSH step out put and store the value into a variable?
    Best Answer

    Broadcom Employee
    Posted Nov 22, 2017 01:33 AM

    Hi,

     

    Then you need to
    1. Add the "Store Step Response" filter to the "SSH Step" and save to the different property name.
    2. Add the "Exeute Script (JSR-223) Step" just after the "SSH Step" and you need to write script to extract only "-922" value from the property which was saved in Step1.
    When using the "Exeute Script (JSR-223) Step", you can write a script by using the "BeanShell", "Groovy", "JavaScript" or "Velocity".
    And you can find some kinds of script samples by searching in the community.

     

    Cheers,