Getting java.lang.NullPointerException when using TestData.getValue


#1

I’m trying to use getValue method defined in com.kms.katalon.core.testdata.DBData to get data using column name but i’m getting a null pointer exception

i’m able to use the column number version but not by name version

Reason:
java.lang.NullPointerException
at com.kms.katalon.core.testdata.DBData.verifyColumnName(DBData.java:110)
at com.kms.katalon.core.testdata.AbstractTestData.getObjectValue(AbstractTestData.java:131)
at com.kms.katalon.core.testdata.AbstractTestData.getValue(AbstractTestData.java:102)
at com.kms.katalon.core.testdata.TestData$getValue$0.call(Unknown Source)
at mypackage.Utilities.GetDroitsUser(Utilities.groovy:91)
at mypackage.Utilities.invokeMethod(Utilities.groovy)
at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:50)
at Command 120.run(Command 120:56)
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 TempTestCase1562166893097.run(TempTestCase1562166893097.groovy:21)

method is defined inside mypackage.Utilities class

@Keyword
def String GetDroitsUser(String username) {

def PrinterAccess = findTestData(‘Data Files/Impriments/DroitsImprUsers’);
println PrinterAccess.getValue(“id_user”, 1)

}

when i use getColumnNames() methode i get this

[nom_ut, id_user, idimprimante, name]

so the column name is correct

this is the api reference
https://api-docs.katalon.com/com/kms/katalon/core/testdata/DBData.html

i’m using katalon v 6.2.1b2


#2

No one has information about this issue ?


#3

For anyone having the same issue here is a workaround until the issue is resolved

static String getValue(TestData dataFile,String columnName,int rowNumber){

	ArrayList<String> table = dataFile.getColumnNames()

	def index = table.indexOf(columnName)

	return dataFile.getValue(index+1, rowNumber)

}

#4

@ThanhTo Please follow this issue