Forum Discussion

saurabhsharma09's avatar
saurabhsharma09
Contributor
11 years ago

[R] Remove NULL Property values before using in XPath Match

Hello,

I have compared REST Service Response with JDBC Data Source and Used XPATH Match step in Assertion Test Steps to achieve the same.
Project Structure is like below:-
1. REST Service Step
2. JDBC Step
3. JDBC Data Source Step to Extract values from JDBC Step Response.
4. Assertion Test Step(With Source as "REST Service Step" and Property as Response) which does XPATH Match for Service Response node values with JDBC Data Source Properties Like:- //../Code/text() Match with ${JDBCDataSource#Code}
5. Loop Step(Having Source as JDBC Data Source Step and Target as Assertion Step to Iterate through JDBC Data Source values)
Now the problem is that JDBC Step returns empty nodes(i.e. <NODE_ID/>) for NULL values whereas NULL values are not returned in Service Response XML as per Implementation
and due to this my XPATH Match assertion gets failed with Error "FAILED - XPathContains comparison failed, expecting [], actual was [491253]".
Is there any way to check/remove JDBC Data Source property value and then use it in XPATH Match Assertion?

Thanks,

2 Replies