- OS : Windows 7
- Katalon Studio Version : 5.3.0.1
- Katalon Studio logs: I think log is not necessary for this case
- Environment (for Web testing): Firefox 52.6
- Environment (for Mobile testing): N/A
Steps to reproduce problem
I made a Test case as follows:
WebUI.navigateToUrl(targetURL)
allLinks = WebUI.getAllLinksOnCurrentPage(true, [])
allLinks.each({ def link ->
if (shouldCheckForAccesibility(link)) {
boolean result = CustomKeywords.'com.happymigration.UrlUtils.verifyUrlAccessible'(link) WS.comment('Verifying a link to ' + link)
WS.verifyEqual(true, result, FailureHandling.CONTINUE_ON_FAILURE)
}
Thread.sleep(500 /* wait for 0.5 second, to be gentle for the targeted site */)
})
def shouldCheckForAccesibility(String url) {
if (!url.startsWith('http://') && !url.startsWith('https://')) return false
if (url.contains(GlobalVariable.G_Hostname)) return false
if (url.contains('style.nikkei.com')) return false
if (url.contains('font-awesome')) return false
if (url.contains('fonts.googleapis.com')) return false
if (url.contains('www.facebook.com')) return false
if (url.contains('twitter.com')) return false
return true
}
Actual Behavior
When run, WS.verifyEqual(obj1, obj2) emitted messages as follows:
INFO 02-27-2018 04:48:39 午後 Verifying a link to 404 Not Found
FAILED 02-27-2018 04:48:39 午後 Unable to verifyequal between actuial object ‘true’ and expected object ‘false’ (Root cause: Actual object ‘true’ and expected object ‘false’ are not equal)
Are you kidding me? The message “true and false are not equal” is totally useless, waste of space.
verifyEqual_emits_useless_FAILED_message.PNG
Proposed Behavior
I want to code like this:
if (shouldCheckForAccesibility(link)) {
boolean result = CustomKeywords.'com.happymigration.UrlUtils.verifyUrlAccessible'(link) String msg = 'Verifying a link to ' + link + ': NG'
WS.verifyEqual(msg, true, result, FailureHandling.CONTINUE_ON_FAILURE)
}
and I would expect to have only a single line of FAILED message like this:
FAILED 02-27-2018 04:48:39 午後 Verifying a link to 404 Not Found NG
The idea of passing failure message as argument to assertion methds comes from JUnit. JUnit’s assertEqual method accepts String message which will be emitted in the FAILURE message.
Assert (JUnit API)(java.lang.String, java.lang.Object, java.lang.Object)