Use relative path for excel or csv data files in data driven test suite not working

Using excel or csv data files in a data driven suite doesn’t work when using relative path for KRE. Works fine locally using KSE.

#### Please let us know what you are using Katalon Studio for?
3. I have currently applied Katalon Studio in my project

#### How would your work be affected if this issue has not been resolved?
4. I cannot continue my job and have to work on something else while awaiting your response

#### Operating System
Ubuntu 16.04 LTS

#### Katalon Studio Version

#### Katalon Studio logs

16:10:43 com.kms.katalon.execution.exception.ExecutionException: java.lang.NullPointerException 16:10:43 at com.katalon.platform.internal.console.LauncherOptionParserPlatformBuilderImpl$PluginTestSuiteLauncherOptionParser.getConsoleLauncher( 16:10:43 at com.kms.katalon.execution.console.ConsoleExecutor.execute( 16:10:43 at com.kms.katalon.execution.console.ConsoleMain.launch( 16:10:43 at com.kms.katalon.console.application.ConsoleApplicationStarter.start( 16:10:43 at com.kms.katalon.application.Application.runConsole( 16:10:43 at com.kms.katalon.application.Application.start( 16:10:43 at 16:10:43 at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication( 16:10:43 at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start( 16:10:43 at 16:10:43 at 16:10:43 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 16:10:43 at sun.reflect.NativeMethodAccessorImpl.invoke( 16:10:43 at sun.reflect.DelegatingMethodAccessorImpl.invoke( 16:10:43 at java.lang.reflect.Method.invoke( 16:10:43 at org.eclipse.equinox.launcher.Main.invokeFramework( 16:10:43 at org.eclipse.equinox.launcher.Main.basicRun( 16:10:43 at 16:10:43 at org.eclipse.equinox.launcher.Main.main( 16:10:43 Caused by: java.lang.NullPointerException 16:10:43 at com.kms.katalon.controller.TestDataController.getTestDataInstance( 16:10:43 at com.kms.katalon.execution.entity.TestSuiteExecutedEntity.findTestData( 16:10:43 at com.kms.katalon.execution.entity.TestSuiteExecutedEntity.prepareTestCaseExecutedEntity( 16:10:43 at com.kms.katalon.execution.entity.TestSuiteExecutedEntity.loadTestCases( 16:10:43 at com.kms.katalon.execution.entity.TestSuiteExecutedEntity.prepareTestCases( 16:10:43 at com.katalon.platform.internal.console.LauncherOptionParserPlatformBuilderImpl$PluginTestSuiteLauncherOptionParser.getConsoleLauncher( 16:10:43 … 18 more

I should clarify after looking into this more, this is only an issue if you create your own folder within the katalon project directory and store the excel and csv files there. If you put excel files in the root project directory or katalon specific directory(e.g. Data Files, Reports, etc folder) and specify use relative path you don’t run into an error where KRE cannot find the files. So right now I have a workaround, but this issue should be addressed.

I should note there seems to be an issue with moving files in a project.
(1) Make data file in katalon attached to excel or csv external file (relative path)
(2) Move the csv or excel file, and update the data file in katalon.
(3) Run tests with KRE in linux, null pointer exception thrown for not finding the data files in Katalon.
Only way to fix this is to delete the data file in Katalon, and create a new one with a different name.

When you use “relative path”, you should be well aware what is the base directory to which the relative paths are resolved.

Try to create a simple test case.

import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths
import com.kms.katalon.core.configuration.RunConfiguration

Path currentDir = Paths.get(".")
println "currentDir: " + currentDir.toAbsolutePath().toString() 
println "Files.exists(currentDir)? " + Files.exists(currentDir)

Path csv = Paths.get("ExternalData/CSV.csv")
println "csv: " + csv.toAbsolutePath().toString() 
println "Files.exists(csv): " + Files.exists(csv)

println "RunConfiguration.getProjectDir(): " + RunConfiguration.getProjectDir()

Please try executing this script in KSE and KRE, and find how the current directory is set in each cases. The current directory is set differently in KSE and KRE.

In KSE, the current directory is equal to the directory where your “project” is located.

In KRE, the current directory is equal to the directory where Katalon Runtime Engine is installed.

The last line of the above code (RunConfiguratiion.getProjectDir()) will help you.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.