I am trying to automate a test case where i have applied a filter on one of the XML Xpath. I want the filter to give me a round off value up to 2 decimal places. How can perform these steps?
An xpath filter of:
round(xpath_filter *100) div 100
should provide you the rounded value to 2 decimal places
By this I assume lisa supports predefince math fucntions which can be used with properties when creating.
Please let me where can i find the syntax for the same.
Hi Avinash --
You said yourself that it's xpath. What I posted was xpath syntax, as LISA uses xpath libraries and supports xpath syntax. There are thousands of websites (and many books) that go through xpath syntax.
I get it thanks Rick.
If we don't use Xpath filters, is there any filters where we can apply our own math functions or use any predefined functions which lisa supports.
If you want to do general purpose rounding of a value in a property, I would do it in a scripting step. That step uses scripted Java so you can do anything you want in there, and there are even more websites with samples and instructions than there are for xpath. For example ...
myUnroundedNumber = testExec.getStateValue("myProperty");
myRoundedNumber = Math.round(myUnroundedNumber * 100.0) / 100.0;
Instead of setStateValue, you could put a filter on the step to save the return value to a property.
Thanks Rick ....
Retrieving data ...