I made a Test Data named testing_checkbox
similar to yours as this:
I made this Test Data based on a CSV file, not Excel, but this difference should not be significantt at all.
I wrote a Test Case:
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import com.kms.katalon.core.testdata.TestData as TestData
// see the doc of TestData class at
// https://api-docs.katalon.com/com/kms/katalon/core/testdata/TestData.html
TestData testData = findTestData("testing_checkbox")
int numberOfRows = testData.getRowNumbers();
for (int rowx = 1; rowx <= numberOfRows; rowx++) {
String c1 = (String)testData.getObjectValue("C1", rowx)
String c2 = (String)testData.getObjectValue("C2", rowx)
String c3 = (String)testData.getObjectValue("C3", rowx)
String c4 = (String)testData.getObjectValue("C4", rowx)
String c5 = (String)testData.getObjectValue("C5", rowx)
String c6a = (String)testData.getObjectValue("C6a", rowx)
String c6b = (String)testData.getObjectValue("C6b", rowx)
println "C1=${c1}, C2=${c2}, C3=${c3}, C4=${c4}, C5=${c5}, C6a=${c6a}, C6b=${c6b}"
// here you can insert any statements that uses the variable c1, c2, ...
}
When I ran the Test Case, I got the following output in the console:
2024-01-19 12:13:10.022 INFO c.k.katalon.core.main.TestCaseExecutor - --------------------
2024-01-19 12:13:10.027 INFO c.k.katalon.core.main.TestCaseExecutor - START Test Cases/TC1
C1=1, C2=1, C3=1, C4=1, C5=0, C6a=0, C6b=0
C1=1, C2=1, C3=1, C4=1, C5=1, C6a=0, C6b=0
C1=1, C2=1, C3=1, C4=1, C5=0, C6a=1, C6b=0
C1=0, C2=0, C3=0, C4=0, C5=0, C6a=0, C6b=1
2024-01-19 12:13:10.779 INFO c.k.katalon.core.main.TestCaseExecutor - END Test Cases/TC1
Please find that this Test Case can get access to data of cells. The code identifies each cells by the combinations of rowx
(row index) and column name
such as “C1”, “C2” etc.
This sample code shows how to read the Test Data. You can start with this sample code, change it, add any statements as you need.
@insyirahmajid
My sample code does “Data Binding” on it’s own. It read an external data source, digest it into rows, pick up data items in a row into a set of variables so that you can refer to the data via variables. I guess, that is what you wanted to do.
Stop using “Manual mode” which would not let you iterate over the data rows. You need to do real programming in the “Script mode”.
You can find the API documentation of Test Data
class at