How to get the Virtual Service basepath at runtime
search cancel

How to get the Virtual Service basepath at runtime


Article ID: 135288


Updated On:


CA Application Test Service Virtualization


Using testExec.getStateValue("testCase"), we can get the VS name at runtime.

Similarly, how can we get the BasePath of the VS at the runtime?


All supported DevTest releases.




The method 'testExec.getStateValue' gets the value of a DevTest property at runtime. 

Some properties are created and maintained by DevTest. Additional properties can be created in the project or by the .vsm as part of an assertion or utility step.

Each step shows a tab for 'Properties Referenced' and 'Properties Set' when opening the step in the Workstation.

Also in the Workstation you can see a tab with a list of all properties and all Global properties on the right hand side.

Inspection View in the Portal also shows which properties are being set.


When running WebServicesModel from the examples project, Inspection View shows that the basepath is not shown as an individual property.

But it can be seen as part of the property lisa.vse.http.current.transaction:


com.itko.lisa.vse.http.HTTPTransaction[method=POST, uri=/itkoExamples/EJB3UserControlBean, httpVersion=1.1, headers=Content-Type=text/xml; charset=utf-8&SOAPAction=""&User-Agent=Axis/1.4- ...


So to get the basepath by itself, this needs to be parsed from the property lisa.vse.http.current.transaction or it needs to set in project and then used within the vsm.


A filter can be used to parse the basepath part of the string and assign just the basepath to a new property. 


Steps to create a filter for the basepath property:

As a test you could use the 'WebServicesModel.vsm' VS and webservices-vs.tst test from the examples project.

Run the VS in ITR and send a request to the VS. 

Then after receiving the request in ITR, select the Properties tab for the executed listener step.

At the bottom there is a button: 'Export the value of these properties from runtime to design time'.

This will export the runtime properties from the listener step.

You export lisa.vse.http.current.transaction or the step response. 

Then after exporting the properties, click on the listener step in design mode and add a filter.

Select 'Utility -> Create Property Based on Surrounding Values' as the filter.

In 'Filter in' select the newly exported property like lisa.vse.http.current.transaction

In the filter mark the sections that are static like 'uri='

Mark the section where the basepath is located and give it a property name.

Save the VSM and test. 

At runtime you can refer to the basepath with the chosen property name.


1564464227543__basepath.JPG get_app