Can we create assertion in LISA , that can check for more than one value , like making "Ensure result contain string" assertion accept more than one parameter
Try using the "Ensure result matches expression" assertion. It would allow you to use a regular expression to check for multiple values by using the pipe "|" character between expressions. Try looking here for a tutorial on writing an expression to handle this: Regex Tutorial - Alternation with The Vertical Bar.
Thank you aveke :-) It worked.
Where can i see the "Ensure result matches expression" I am not finding this. I am using LISA r7.5.2
I am writing functional test cases to test the REST services. I have written REST Test STEP to pick different test data from a DataSet. Dataset has different test data “+ ve test data” & “-ve test data”.
In case of “+ve test data” the Response is giving Success. In case of “-ve test data” the Response is sending different error code based on different scearnio like below:
Error Code- 9999 – Invalid XMLError Code- 0000 – Invalid DataEtc..
I want to capture the different error code and capture these in the logs.
My question is how I can do it. - Can I write different Assertion to capture different error code and capture in the logs? OR- I want to log accurate error message based on the error code returned in the JSON Response.- Can I write BeanShell Script to capture different error code and capture in the logs? OR- What step is the best and easy way to achieve my objective?
Please help me on this.
My apologies for delayed response. You can find Ensure result matches expression in Add Assertion->Other-> Ensure result matches expression.
For your problem, you can write two ensure result matches expression assertions which checks the same response for different error codes and display log messages accordingly. This is the simpler one if your error codes are less in number But if your error codes are many then go for a Java script step.
Retrieving data ...