Checking for a 500 error

I’m loading a bunch of URL’s with the code below & then verifying that it loads:

list = WebUI.getAllLinksOnCurrentPage(false, )

for (def url : list) {
//Go to link
WebUI.navigateToUrl(url)

//Wait for it load
WebUI.waitForPageLoad(30)

//verify current url
urlCurrent = WebUI.getUrl()

WebUI.verifyMatch(url, urlCurrent, true)

}

===================================

This is just a quick sanity check of the application. How do I check for a page that has a 500 response code?

Basically, something like this:

If response code NOT 500, continue.

Thanks,

Brian

I don’t think you can check for http response codes (at least, not loading pages via regular Katalon WebUI APIs [1]).

You’ll probably want to recognize what the page looks like when (un)successfully loaded, and respond accordingly. IOW, you have a little more work to do after WebUI.waitForPageLoad(30) has completed.

And btw, http 500 is pretty catastrophic, anyway: means the server went kaboom on you. Any asynchronous request after the page initially loads could also return a 50x error. Going the route you are, that could open a rats nest of unscalable testing requirements. Your best bet is as I said, pull back, and deal with “overall outcomes”, recognize a working page, all else is an error.

[1] Alternative approach: Use the site itself as a pseudo-webservice. Once you do that you can check response codes. Tricky, but do-able. Sounds messy though.

Thanks for the info. Yeah, this is just a quick sanity test of the website. It won’t be used very often, but can be helpful to verify that nothing obvious is broken.