Problem
As I reported in Want to pass as argument Message to WebUI.verifyEqual(message, actual, expected), WebUI.verifyEquals method emits a silly message on failure:
true and false are not equal
Solution
Liam B suggested developping a custom keyword which enables me to emit favorable message. So I have developed a custom keyword. Let me share it:
I made a Test Case:
import com.kms.katalon.core.model.FailureHandling
def expected = "Ken"
def actual = "Marry"
CustomKeywords.'com.kazurayam.ksbackyard.Assert.assertTrue'(
"${expected} is not ${actual}", expected == actual,
FailureHandling.OPTIONAL)
expected = "Tom"
actual = "Jerry"
CustomKeywords.'com.kazurayam.ksbackyard.Assert.assertEquals'(
"${expected} is not equal to ${actual}", expected, actual,
FailureHandling.CONTINUE_ON_FAILURE)
expectedNumber = 0
actualNumber = 999
CustomKeywords.'com.kazurayam.ksbackyard.Assert.assertEquals'(
"${expectedNumber} is not equal to ${actualNumber}", expectedNumber, actualNumber,
FailureHandling.STOP_ON_FAILURE)
When I ran the test case I got the following output:
08-14-2018 10:24:54 AM - [WARNING] - Ken is not Marry
...
08-14-2018 10:24:54 AM - [FAILED] - Tom is not equal to Jerry
...
08-14-2018 10:24:54 AM - [FAILED] - 0 is not equal to 999
...
08-14-2018 10:24:54 AM - [FAILED] - Test Cases/test/AssertTest FAILED because (of) 0 is not equal to 999
I am pleased to see a message Ken is not Marry
here