Service Virtualization

  • 1.  Create Property based on Surrounding Values-Use

    Posted Dec 01, 2017 06:46 AM

    # monika mehta

     

    I am not able to use this fitler properly. I want to store primaryAccountHolder value into a property value . When i selected with Property icon i am gettin error that it should be given between 2 must blocks.

     

     

    Read the below link : and not getting clear idea on the purpose of this filter as well. Pls clarify

    Create Property Based on Surrounding Values - DevTest Solutions - 8.2 - CA Technologies Documentation 



  • 2.  Re: Create Property based on Surrounding Values-Use

    Posted Dec 01, 2017 01:06 PM

    Just so you know, to get Monika's attention use the "@ Mention" and add her name so she will see your query.  For example (monika_mehta

     

    Also, can you upload a scrubbed down version of your information so we can play with it to see what is going on?

     

    Let's assume you have some XML wrapped inside some other information.  

    An example could be:

    { Data="<?xml version="1.0" encoding="UTF-8"?><SomeXML><StatusRequest><status>PROCESSING</status></StatusRequest></SomeXML>" }

     

    Now, let's assume that you want to extract only the XML from this payload using the Create Property Based on Surrounding Values filter.

    Using the above, we configure the Create property based on surrounding values with information to indicate which portions of the payload to ignore and which portions to create a filter from.

    The highlighted data at the beginning and end of the payload (e.g., { Data=" and " } ) will be ignored and only the XML will be used to create a property.

     

    1) Create a simple test case.

    2) Add a Parse Text as Response step to the test case.

    3) Copy/Paste the fragment above and assign it a property key name and click Test. This will set LASTRESPONSE and create a property called fl_rcd.

    4) Add the Create Property Based on Surrounding Values filter. It is OK to filter In the LASTRESPONSE or you could also filter in fl_rcd.

    5) We need to configure the Filter with indicators on how to extract data and create a new property.

    A) Using the cursor, highlight the text at the beginning of the property

    B) CLICK the 'Mark that selected text must remain precisely as shown' button. 

     

    C) Perform the same action on the " } value at the end of the line.  Once these two actions are completed, both exclusions will be highlighted as shown.

    D) Select the XML payload and CLICK the 'Mark Selected Text As Allowed to Change' button.

    E) Highlight the XML payload again and CLICK the Token Selected will be Stored in a property button.

    Enter a Filter Name for the selected content.

    The XML will be replaced with the new property using {{ }} notation.

    F) Run the Filter and notice the XML is pulled from the payload and set into a property.



  • 3.  Re: Create Property based on Surrounding Values-Use
    Best Answer

    Posted Dec 05, 2017 10:04 AM

    Update:

    It appears to me that you did not add a "mark selected text must remain precisely the same" marker after the primary account holder.

    Your Screen Shot:

    My screenshot with the tag and filters.

    Optionally, if "sow: C" is the start of the JSON and the payload is valid JSON, you could extract the entire JSON payload and then add JSON Path Filters to access and set the same properties.  For ex: