Thanks a lot for your reply, yes, I used your code in calculating dates and it worked perfectly.
At first, I was expecting some element for eligibility in the response so I could easily add assertion but our developers coded in a different way, when eligible the response displays the ruleID; when not eligible the response doesn't display ruleID, so I consider the existence of the node like:
import com.eviware.soapui.support.XmlHolder
def holder = new XmlHolder( messageExchange.responseContentAsXml )
holder.namespaces["NDS"] = "XXXXXX"
def node = holder.getDomNode( for ruleID )
assert node != null
But then the problem is, if I do "assert node != null", all test steps for non-eligible status will fail, we actually don't want them fail, we want them pass but with some indication that the patient is not eligible, so we'd like to use a variable or something to hold the status of eligibility (or ruleID since it only displays if eligible). My plan is that I give a DOB and a value for status in the data source, when I run a test step, if there's the ruleID in the response, or such a node, the status is true, then compares with the value in the data source, if they are the same, the test step passes, for example:
I give "DOB1, true" in data source, here DOB1 is older than 2 yrs old, the response displays ruleID, maybe a script set a status varaible to be true, then compares with the "true" in the data source, since they are the same, the test step passes. If I give "DOB2, false" in data source, here DOB2 is less than 2 yrs old, the response doesn't display the ruleID, the node is missing, so the script set status to be false, then compares with the "false" in the data source, since they are the same, the test step passes, a test step should only fail when its output status is different from the status in the data source, which means either the rule calculates wrong, or our logic is wrong (typical for negation test)
Please keep in mind, we test a rule as black box, we can only conclude based on the output (response), since the response doesn't display anything if not eligible (except a missing node), that makes the assertion difficult, also, this is a bit out of assertion aspect, do you have any suggestion or recommendation in coding this kind of script please?
Thanks a lot
Jerry