Service Virtualization

Expand all | Collapse all

Save javascript variable as Property in LISA

  • 1.  Save javascript variable as Property in LISA

    Posted Mar 08, 2018 07:20 AM

    I want to make use of the variable declared in the java script in other steps. How can I add it as a property value or make as global in LISA?

     

     

    For ex:

    if(("{{M}}" == "{{me}}") && ("{{ST}}" == "{{s}}") && ("{{SO}}" == "{{sr}}"))
    {
    testExec.setStateValue("Result","Pass");
    }
    else
    {
    testExec.setStateValue("Result","Fail");
    }

     

    I want to make use of Result in other steps in LISA.



  • 2.  Re: Save javascript variable as Property in LISA
    Best Answer

    Broadcom Employee
    Posted Mar 08, 2018 09:56 AM

    Using testExec.setStateValue will store the variable for use in the scope of the current request across the steps. In the other steps, you can either reference is using {{Result}} or use testExec.getStateValue("Result"). Please let us know if this is the requirement and if you are facing any issues with this. 



  • 3.  Re: Save javascript variable as Property in LISA

    Posted Mar 09, 2018 09:45 AM

    It worked