Contributions
Re: How to verify response content
You are just in time! I am on the last step but I have a major problem.The request gives you a response that contains token,expiry date,status and a result.Currently each time you run the test the token and the expire date change.I don't really know how to store it in the list type variable for the assertion.For an example I handelded the 2nd case this way : And it works.I want to do the same with the first case where I store the parameters and then compare the lists from the groovy script.Although because it changes every time I would have to hardcode it like this : assert jsonSlurper.code== "Success" which they told me not to do.It is currently 3 am and I really want to finish it today if possible.1.5KViews0likes2CommentsRe: How to verify response content
I have a minor of a problem.I sent my version to them which was correct and worked,but they wanted me to use groovy lists.I am currently trying to improve the code without the for loop for now. But it always pops up an error.Any clues on how to fix it?1.5KViews0likes4CommentsRe: How to verify response content
Yes that's the for loop I am looking for.I need to shorten the 3 test cases to 1 by using the loop as you have said.Yes I also can use normal script assertions so it should be fine.as for the Gui I am pretty sure I can use it as well.Thanks for the replies&help1.5KViews0likes11CommentsRe: How to verify response content
As far as i understood,I should be verifying response tokens. Here is the code I wrote and it works: def headers = messageExchange.getResponseHeaders() log.info headers["#status#"] assert ['HTTP/1.1 200 OK'] == headers["#status#"] def actualStatus = headers["#status#"].get(0) def excelExpectedValue = '200 OK' def expectedStatus = 'HTTP/1.1 '+excelExpectedValue assert expectedStatus == actualStatus def responseContent = messageExchange.response.responseContent def jsonSlurper = new groovy.json.JsonSlurper().parseText(responseContent) def actual=jsonSlurper.status def actuelResult = jsonSlurper.result assert actual == "Success" assert actuelResult == "User authorized successfully." First one confirmes that the HTTP code is correct.and the second one confirmes that the message I got from the request mathes the response.Although I did 3 test cases for 3 different scenarios.My teacher asked me to loop it and make it shorter.No clue on how to do that though.Any help would be appreciated1.6KViews0likes13CommentsRe: How to verify response content
Yes sorry for such a bland explonation.For an example when i put the first request in this response comes in.I need to validate the response values with the assertion that this came in.I tried using this method: def slurper = new groovy.json.JsonSlurper() def result = slurper.parseText('{"code": "1200","message": "UserName and Password required."}') assert result.code == "1200" assert result.message == "UserName and Password required." But i do think that it is not dynamic so i want to change it.Thanks for the replies&help1.6KViews0likes17CommentsSoapUI request/response questions
Hello,I have a question regarding my homework here.As you can see on the photos,I am stuck on the validate part.Which assertion am I supposed to use? How am I supposed to use groovy lists here? Here is the actual link for the reference:https://bookstore.toolsqa.com/Account/v1/GenerateToken379Views0likes0Comments