Forum Discussion
- marlonumali8 years agoOccasional Contributor
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.
- PaulMS8 years agoSuper Contributor
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)
- nmrao8 years agoChampion Level 3Then that should be considered as an additional assertion which you could do apart from "Schema Compliance".
By the way, the sample data provided does not have any such type though.
Related Content
- 2 years ago
- 4 years ago
- 4 years ago
- 9 years ago
Recent Discussions
- 24 hours ago