Service Virtualization

Expand all | Collapse all

How to use a property set in a subprocess across all the test cases

Jump to Best Answer
  • 1.  How to use a property set in a subprocess across all the test cases

    Posted 08-25-2018 10:25 AM

    Hi All,

    I have a scenario where I get a user token from a subprocess step which needs to be passed in the header of all the api calls. 

     

    Instead of calling the subprocess and getting back the token in each and every test case, Is it possible to set the user token property at project level from the subproccess, so that it can be used by all the test cases by passing the lisa property {{token}} in the headers of the requests which is set from the subprocess.#

     

    Thanks,

    Saberesh



  • 2.  Re: How to use a property set in a subprocess across all the test cases
    Best Answer

    Posted 08-27-2018 08:43 AM

    Since you indicate multiple test cases need to use the same token, you might consider using the Persistent Model Map.

    If the test cases are part of a test suite, you might add a pre- test case that initializes the token prior to executing the test cases, have each test case use the token, and execute a post- test case to remove the token.

    If the test cases execute outside a test suite, you might check the map, if the token exists use it. If the token does not exist, call the subroutine to create, store it in the map, and use it.

    Here are some links to review:

    How to iterate over a persistent model map in javascript step? 

    How to pass a property, set by one Lisa Test Case to other Lisa Test Cases  

    How to transfer a property from one test case to other test cases in a Project   

     Whatever you do, consider a design that provides the ability to clean up the map between executions.