Service Virtualization

  • 1.  How to check whether a LISA property contains another LISA property?

    Posted Oct 29, 2018 06:58 AM

    I need to check whether a property in LISA contains another property value in LISA.

     

    For Ex:

    If {{flow_id}} = "CHECK" and {{id}} = "HE"

    I need to check whether flow_id contains id, if yes I need to say "YES"

     

    Could you please help in this?



  • 2.  Re: How to check whether a LISA property contains another LISA property?

    Broadcom Employee
    Posted Oct 29, 2018 07:29 AM
      |   view attached

    You can use the assertion “Ensure property matches expression”

     

    Property Key: flow_id

    RegExpression: .{{id}}.

     

     

     

    You cannot make an assertion say “YES”, you can either continue with the next of your current step, or you can let the assertion branch to another part of your test. The “next” of your current step could be a step that sets a property to YES, the “then” of your assertion could branch to a step that sets a property to NO, and then the 2 threads could join again.

     

    Also, this could not work if the property id contains some characters which are regec special characters, things like . *  , etc…

     

    An alternative is to write a few lines of java in an Execute Script step:

     

    String flow_id = testExec.getStateValue("flow_id");

    String id = testExec.getStateValue("id");

    String result;

    if (flow_id.contains(id))

    {

       result = ("YES");

    }

    else

    {

       result = ("NO");

    }

    testExec.setStateValue("result", result);

     

     

     

    Cheers,

    Danny