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

ISSUE
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
7.8.2

#### Katalon Studio logs

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(LauncherOptionParserPlatformBuilderImpl.java:130) 16:10:43 at com.kms.katalon.execution.console.ConsoleExecutor.execute(ConsoleExecutor.java:74) 16:10:43 at com.kms.katalon.execution.console.ConsoleMain.launch(ConsoleMain.java:352) 16:10:43 at com.kms.katalon.console.application.ConsoleApplicationStarter.start(ConsoleApplicationStarter.java:37) 16:10:43 at com.kms.katalon.application.Application.runConsole(Application.java:125) 16:10:43 at com.kms.katalon.application.Application.start(Application.java:88) 16:10:43 at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) 16:10:43 at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) 16:10:43 at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) 16:10:43 at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388) 16:10:43 at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243) 16:10:43 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 16:10:43 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 16:10:43 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 16:10:43 at java.lang.reflect.Method.invoke(Method.java:498) 16:10:43 at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673) 16:10:43 at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610) 16:10:43 at org.eclipse.equinox.launcher.Main.run(Main.java:1519) 16:10:43 at org.eclipse.equinox.launcher.Main.main(Main.java:1492) 16:10:43 Caused by: java.lang.NullPointerException 16:10:43 at com.kms.katalon.controller.TestDataController.getTestDataInstance(TestDataController.java:223) 16:10:43 at com.kms.katalon.execution.entity.TestSuiteExecutedEntity.findTestData(TestSuiteExecutedEntity.java:261) 16:10:43 at com.kms.katalon.execution.entity.TestSuiteExecutedEntity.prepareTestCaseExecutedEntity(TestSuiteExecutedEntity.java:210) 16:10:43 at com.kms.katalon.execution.entity.TestSuiteExecutedEntity.loadTestCases(TestSuiteExecutedEntity.java:191) 16:10:43 at com.kms.katalon.execution.entity.TestSuiteExecutedEntity.prepareTestCases(TestSuiteExecutedEntity.java:113) 16:10:43 at com.katalon.platform.internal.console.LauncherOptionParserPlatformBuilderImpl$PluginTestSuiteLauncherOptionParser.getConsoleLauncher(LauncherOptionParserPlatformBuilderImpl.java:103) 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.
Steps:
(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.