Contributions
Script assertion to check date time between min and max
I'll appreciate your time and expertise since I'm not sure what is wrong. Following groovy script works if def expectedMinDateTime is exact as the epoch conversion. However, I was thinking it should pass because assert is given as >. //imports import groovy.json.JsonSlurper // EXPECTED RESULTS - MODIFY HERE >>>>>>>>>>>>>>>>>>>>// 18:00-20:00 is PST in input, to get CST +2hr = 20:00 - 22:00 for server time//We want to test the time is CST because PST is origination def expectedMinDateTime = '2020-11-03 18:00:00.000Z' def expectedMaxDateTime = '2020-11-03 20:00:00.000Z' def attemptNumber = 1 // RNF <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< //grab the response def ResponseMessage = messageExchange.response.responseContent //defines a JSON Slurper def jsonResponse = new JsonSlurper().parseText(ResponseMessage) //verify the slurper is not empty assert !(jsonResponse.isEmpty()) //get the epoch date def epochScheduledDateTime = jsonResponse[0].ScheduledAttempt.ScheduledDateTime log.info(epochScheduledDateTime) // epoch is 1604449835 //convert epoch date to milliseconds in long int else it will be truncated Date date = new Date((epochScheduledDateTime) * 1000L); log.info(date) //format date def formattedScheduledDateTime = date.format("yyyy-MM-dd HH.mm.ss.SSS Z") log.info(formattedScheduledDateTime) assert(formattedScheduledDateTime > expectedMinDateTime) ------------------(this fails as it is looking for exact match) assert(formattedScheduledDateTime <= expectedMaxDateTime) ------------ (this passes as time is less than max) I'm trying to get pass if epoch converted time is between 18:00 and 20:00.Solved4 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.5KViews0likes2CommentsRe: Error in parsing CDATA response
Thank you NMRao. I did reach out to the team and format is not real XML. However, as suggested, when I added <root></root> after removing 'OK:' to the response, I was able to get just the guest_no. I'll look into some of your script on if any node can be added to the response or not. Your scripts and reply helped.1.4KViews0likes1CommentError in parsing CDATA response
Hello, I'm using SOAPUI Open Source tool and fairly new to the tool. After much googling and understanding CDATA parsing, I have finally come to the forum to ask for help. Actuallcall Response from above call I'm trying to extract guest_no tag that is inside CDATA which is inside rInvokeResult tags. I then want to use the value of guest_no in subsequent call. So, I tried using Property Transfer by first, extracting the value from CDATA and then transfering to other test step/call but so far I'm getting following error. If I use //ns1:rInvokeRespone[1]/ns1:rInvokeResult[1] then I get everything. I'll really appreicate your help or guidance. Thanks.1.5KViews0likes3Comments