NULL value unable to verify match

Am i being super dumb or? - please someone tell me why this is not verifiying they are matched even though both values are null

//SQL query and Get response
def response = WS.sendRequestAndVerify(findTestObject('GET/Persrec'))

CustomKeywords.'db.sql.connectDB'(GlobalVariable.dataBase, GlobalVariable.dataBaseUsername, GlobalVariable.dataBasePW)

def persrec = CustomKeywords.'db.sql.executeQuery'('SELECT * FROM Persrec WHERE PerID IN (1)')

//Parse json repsonse
def responseText = response.getResponseText()
String jsonString = responseText
JsonSlurper slurper = new JsonSlurper()
Map parsedJson = slurper.parseText(jsonString)

println responseText

def row = -1

String prefix = 'Per'

String[] testArray = ['Name', 'KnownAs', 'AbsYearID' , 'AddressDateFrom' , 'AddressLine1' , 'AddressLine2' , 'AddressLine3', 'AddressLine4' , 'AppRefNo' , 'BasicPay' , 'CarRegNumber' , 'ccRejectionsToMe', 
'CompanyCar', 'ContractEnd', 'ContractEnd', 'ContService', 'CountryID', 'CurrencyID', 'EmployeeNoticePeriod', 'EmployeeNumber' , 'EmployerNoticePeriod']

//String[] testArray1 = ['Name', 'KnownAs']

while (7 > 3) 


    String value1 = persrec.getObject(prefix + testArray[row])

    String value2 = parsedJson.PersonDetail[0].(testArray[row])
	WS.verifyMatch(value1, value2, false)

Error -

test Cases/GET test cases/ListPersrec FAILED.
com.kms.katalon.core.exception.StepFailedException: Actual text 'null' and expected text 'null' are not matched
	at com.kms.katalon.core.keyword.builtin.VerifyMatchKeyword$_verifyMatch_closure1.doCall(VerifyMatchKeyword.groovy:57)
	at com.kms.katalon.core.keyword.builtin.VerifyMatchKeyword$
	at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:68)
	at com.kms.katalon.core.keyword.builtin.VerifyMatchKeyword.verifyMatch(VerifyMatchKeyword.groovy:60)
	at com.kms.katalon.core.keyword.builtin.VerifyMatchKeyword.execute(VerifyMatchKeyword.groovy:45)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
	at com.kms.katalon.core.keyword.BuiltinKeywords.verifyMatch(BuiltinKeywords.groovy:73)
	at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(
	at com.kms.katalon.core.main.TestCaseExecutor.runScript(
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(
	at com.kms.katalon.core.main.TestCaseExecutor.execute(
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(
	at com.kms.katalon.core.main.TestCaseMain$runTestCase$ Source)

EDIT - I think its most likely down to the parameters for the verifyMatch being strings ? Not sure where to go from there though, any help much appreciated

1 Like

Fixed - just used this instead of the keyword

if(value1 != value2)
	 KeywordUtil.markFailed(value1 + " and " + value2 + " do not match.")

@ Katalon Dev’s

I also faced a similar issue. It seems WS.verifyMatch(null, null, false, FailureHandling.CONTINUE_ON_FAILURE) condition is failing with above mentioned stacktrace. Is this is known issue?

For the time being, solution suggested by @hpulsford is working. But it will be great if you guys can look into it.


I am using katalon version 6.3.3, I use WebUI.getAttribute(button, "distabled") which return a null object instead of string “null”. I use the toString method to fix this issue.

WebUI.verifyMatch(WebUI.getAttribute(aButtonTestObject, "disabled").toString, "null", false)