Service Virtualization

  • 1.  Call Property in Javascript step

    Posted Jun 16, 2016 04:57 PM


    how can i use a Property in Javascript step



  • 2.  Re: Call Property in Javascript step
    Best Answer

    Posted Jun 17, 2016 10:12 AM

    closing it as if figured out ..

     

    i was not using double quotes

     

    so Var X = {{StepResponse}}

    doesn't work but below does

     

    Var X = "{{StepResponse}}"



  • 3.  Re: Call Property in Javascript step

    Broadcom Employee
    Posted Jun 17, 2016 10:45 AM

    StepResponse is available as a variable directly.

     

    Vax X = StepResponse;

     

    would also work.



  • 4.  Re: Call Property in Javascript step

    Posted Jun 20, 2016 12:16 PM

    Thanks for the help



  • 5.  Re: Call Property in Javascript step

    Broadcom Employee
    Posted Jun 20, 2016 12:26 PM

    For added safety, I always use

    var x = testExec.getStateValue("propertyName");

    I can force type, if required. For example, if I want to force a string, it would be:

    String x = testExec.getStateString("propertyName", "defaultValue");