Want to pass as argument Message to WebUI.verifyEqual(message, actual, expected)

  • 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 https://tokushima-iju.jp/docs/2041.html
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 https://tokushima-iju.jp/docs/2041.html: 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.
http://junit.sourceforge.net/javadoc/org/junit/Assert.html#assertEquals(java.lang.String, java.lang.Object, java.lang.Object)

1 Like

Hi @4280-kazurayam,

Thank you for your feedback. I have logged a ticket for the team to discuss. In the meantime, please create a custom keyword to assertEqual and print only preferred messages.

Thanks again for using Katalon Studio,
Liam

same case with me its still not fixed :frowning:

Please have a look at

I have got a custom keyword which enables you to emit custom message on assertion failure

2 Likes