I am using SOAP UI free version. I am beginner and working on a groovy script to read a excel, replace properties in a request file and run the request in a loop. For reading response, i gave xpahs and writing the data to a text file. This works fine for a pass scenario because of the xpath. For failed scenario, given xpath is not valid and comes with different tags. So, i am looking to find a way to validate pass or fail or condition the xpath based on a particular tag.
Given xpath for reading data:
def tag1 = responseXmlHolder["//b:tag1"]
def tag2 = responseXmlHolder["//b:tag2"]
Sample Pass Response
Sample Failure Response
<TagResponse xmlns="http://www. ">
<TagResult xmlns:b="http://www. ">
</ TagResult >
</ TagResponse >
<s:Text xml:lang="en-GB">Serialization Error</s:Text>
<Description>There was an error</Description>
<Solution>Please change the value and try again</Solution>
I need some help with adding a condition to read a value and then identify the results. Like if failed then i can read a set of properties using xpath. If passed then i can read a set of properties using different xpaths. Thanks in advance
Things is the targeted test result is known to you before even testing.
If the test is for positive case, that should pass the respective assertion(s).
If the test is negative case, then also the test should pass with respective assertion(s).
Any case, assertions should be passed.
So, design the test cases accordingly.
Thanks Mr. nmrao for the response. @nmrao
I want to put these conditions in same script.
The pass and failure depends on the input i supply for same request. So, i am trying to read both conditions in same script. Based on the xpaths(which depends on the response), it should read the required xpath and ignore the other part. I have to read the xpaths. If xpath1 exists then i have to read the response 1 else if xpath 2 exists i have to read the response2.
Thanks in advance
This problem is resolved. I used contains method for conditioning by converting entire response as string. It worked for my case.
Thanks for your help. 🙂