Forum Discussion
Thank you for your response nmrao, I am hoping that I can validate response data through script assertion because I might need to do some mathematical procedure to validate a Decimal or a DateTime values, such as to test if a response DateTime value is within a certain period like January 1 to March 31, 2017.
Convert the string to date or double, then you could test the values.
http://stackoverflow.com/questions/3817862/groovy-string-to-date
http://stackoverflow.com/questions/5769669/convert-string-to-double-in-java
- marlonumali8 years agoOccasional Contributor
Here is what I did to convert and test my response data.
def response = new XmlSlurper().parseText(hl.prettyXml)
def val1 = response.RootNode.ChildNodedef val2= Date.parse('yyyy-MM-dd' , val1.toString())
assert (val2 instanceof Date)
Related Content
- 2 years ago
- 4 years ago
- 4 years ago
- 9 years ago
Recent Discussions
- 24 hours ago