NULL value unable to verify match


#1

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']

persrec.next()

while (7 > 3) 

{
	
    row++

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

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

Error -

test Cases/GET test cases/ListPersrec FAILED.
Reason:
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$_verifyMatch_closure1.call(VerifyMatchKeyword.groovy)
	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 ListPersrec.run(ListPersrec:45)
	at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
	at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
	at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
	at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
	at TempTestCase1559127907579.run(TempTestCase1559127907579.groovy:21)

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


#2

Fixed - just used this instead of the keyword

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

#3

@ 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.

Thanks