FileNotFoundException with TestOp Agent and Excel DataFiles

Hi it’s me again,

So, I trying now to launch my test collection from Katalon TestOps via Agent.

My test Collection include a test case using a Data File which is an excel file.

When i schedule a job the debug says that it can’t find the DataFiles.

I see that the script is looking inside the temporary agent folder, where my excel isn’t :

Cannot find test data with id 'Data Files/DF-DATA' because (of) 'java.io.FileNotFoundException: G:\Katalon_Agent\tmp\2021.06.23-15.37--9960-cKhojmS78vpa-328722\Projet_ANA\Data Files\Liasses_ANA.xlsx' %

In my test case i declare my file like this :

ExcelData data = findTestData(‘Data Files/DF-DATA’)

And the data file is configured with ‘Use Relative Path’ and ‘Bind to test case as string’ is KSE.

Where did i go wrong ? Do i have to hard-code the path ?

Thanks !

Any help would be appreciate, i’m stuck !

thanks

Then, where is your excel file?

Hi Kazurayam,

My Excel file is on local machine, ‘G:\GITEA\Projet_ANA\Data Files\Liasses_ANA.xlsx’

OK, then

You need to specify use Absolute Path and specify G:\GITEA\Projet_ANA\Data Files\Liasses_ANA.xlsx

Do you mean ‘local machine’ is the PC on your desktop?

Yes on the server where the projet was built with KSE and execute with KRE, before i attempt to run with TestOp Agent.

I have to say that i have a primay test case which build the file with hard-coded path, prior to be used by another TC (the one that actually not find the file). I suppose that is the mistake.

I convert a csv to xlsx like this, and i think the 2 first line had to be adapted with some kind of projet path variable :

    String csvFileAddress = 'G:/GITEA/Projet_ANA/Data Files/result.csv'
    String xlsxFileAddress = 'G:/GITEA/Projet_ANA/Data Files/Liasses_ANA.xlsx'
    SXSSFWorkbook workBook = new SXSSFWorkbook()
    workBook.setCompressTempFiles(true)

    SXSSFSheet sheet = workBook.createSheet('ANA')
    sheet.setRandomAccessWindowSize(1000)
    sheet.trackAllColumnsForAutoSizing()

Perhaps you are asking a question how to find the project path.

This is it.

import java.nio.file.Path
import java.nio.file.Paths

import com.kms.katalon.core.configuration.RunConfiguration

Path projectDir = Paths.get(RunConfiguration.getProjectDir())

Path csvFile = projectDir.resolve("Data Files").resolve("result.csv")
Path xlsxFile = projectDir.resolve("Data Files").resolve("Liasses_ANA.xlsx")

String csvFileAddress = csvFile.toString()    // -> 'G:/GITEA/Projet_ANA/Data Files/result.csv'
String xlsxFileAddress = xlsxFile.toString()  // -> 'G:/GITEA/Projet_ANA/Data Files/Liasses_ANA.xlsx'

println "csvFileAddress=${csvFileAddress}"
println "xlsxFileAddress=${xlsxFileAddress}"

Thanks i will try this afternoon and keep you in touch.