I have to validate the new date coming in my xml response. Tried below groovy script but facing problem in comparing dates as the dates are in String format.
Basically I am trying to validate my new journey date, say my previous journey date is 21 Oct. 19 and now i change the same to 23 Oct. 19, now i have to validate the 23 Oct. 19.
As i am new to programming unable to crack it, tried below :
def odate = messageExchange.modelItem.testStep.testCase.testSuite.getPropertyValue ("DepartureDateTime")
def dateFormat = new SimpleDateFormat("dd-MM-yyyy")
def dateString = ndate
def changedDate = dateFormat.parse("dateString")
odate = new Date().parse('yyyy/MM/dd')
def dateDifference = messageExchange.modelItem.testStep.testCase.testSuite.getPropertyValue ("datediff") as int
assert odate == ndate - dateDifference
Solved! Go to Solution.
Hi @dinojadhav! Have you found a solution? If not, please provide more details, and we will do our best to try and help you here.
HI @dinojadhav, I am very glad to hear this! Could you share your solution with the Community? We would really appreciate it. Thank you!