Issue while writing on excel file with parallel execution

I’ve got interested in the idea of usin SQLite3 in Test Case script in Katalon Studio. I tried it and got a small success. I have created a repository in GitHub

1. I already had SQLite installed into my Mac. I can not remember when and how. Possibly I installed it using Homebrew some months ago.
2. I downloaded the sqlite-jdbc-3.7.2.jar from Maven Central, saved in the Drivers directory of the project
3. created a test case where I just copy and pasted a sample code from http://www.octodecillion.com/groovy-with-sqlite/, as this Test Cases/TC1
4. run the test case — worked fine. In the console I saw messages:

2020-12-14 12:24:41.612 DEBUG testcase.TC1                             - 7: sql.eachRow("select * from person", { -> ... })
id=1, name= leo
id=2, name= yui
2020-12-14 12:24:41.689 INFO  c.k.katalon.core.main.TestCaseExecutor   - END Test Cases/TC1

Now I know that I can read/write SQLite database in test case. My next question is how to write code that uses database table like an Excel worksheet. I need some Object-Relational Mapping mechanism such as groovy.sql.DataSet.

I developed Test Cases/TC2 that employs groovy.sql.DataSet.

This script did not work. When I executed it I got following error.

2020-12-14 18:38:43.141 ERROR c.k.katalon.core.main.TestCaseExecutor   - ❌ Test Cases/TC2 FAILED.
Reason:
groovy.lang.GroovyRuntimeException: DataSet unable to evaluate expression. AST not available for closure: Script1607931888293$_run_closure2. Is the source code on the classpath?
	at TC2.run(TC2:49)
	...

I searched for solution. I found

… quite puzzling. After few hours of struggle, I got an idea. I made a test case Test Cases/TC3

import my.SQLiteDataSetExample

SQLiteDataSetExample.run()

I made a Groovy class my.SQLiteDataSetExample in the Keywords directory. This class does

package my

import groovy.sql.Sql
import groovy.sql.DataSet

public class SQLiteDataSetExample {
	
	static void run() {

            // The code of Test Case/TC2 is just copied here

	}
}

The Test Cases/TC3 worked fine.The error of “DataSet unable to evaluate expression. AST not available for closure” disappeared.

Now I am sure that we can use SQLite as the local data storage for Katalon Studio test cases.

1 Like