How to access 'Data Iteration' value (from Data Bindings) within Test Case?

I am wondering if there is a way to access the ‘data iteration’ value within a Test Case.

Example:
I have an Excel sheet with my data in it.
I want to iterate over the rows within the sheet using Data Bindings and defining which rows to use with ‘Test Data → data Iteration’ value.

Instead of defining variables and assigning them in the ‘Variable Binding’ Section, I have a method that will extract the data values from the Excel sheet [ ExcelData data = findTestData(“PlanSearchData”) ].

code: CustomKeywords.myfile.‘SearchPlan’(‘datafile’)

I want to use the ‘data Iteration’ value to determine which row within the file i am accessing

code: CustomKeywords.myfile.‘SearchPlan’(‘datafile’, row) // use ‘data iteration’ to select row

My attempt to make my test cases easier to write (for non technical people)
go from:

SearchPlan(param 1, param 2, param 3, … ) // where variables are created and assigned in ‘variable bindings’
FillOutForm(param 1, param 2, param 3, … )
For( x=0, …) {

}
more code…

to:

SearchPlan(‘datafile’) // and access the ‘data iteration’ value in the method.
FillOutForm(‘datafile’) // and access the ‘data iteration’ value in the method.
PerformAction()

Has anyone seen this? Anyone working on this? any updates? Thanks

What do you mean by “data Iteration value”?


The article Data-driven testing approach with Katalon Studio shows the following sample code:

import com.kms.katalon.core.testdata.InternalData
 
InternalData data = findTestData("Demo_Account")
 
for (def index : (0..data.getRowNumbers() - 1)) {
    WebUI.openBrowser('')
    
    WebUI.navigateToUrl('http://demoaut.katalon.com/profile.php')
    
    WebUI.setText(findTestObject('Page_Login/txt_UserName'), data.internallyGetValue("demo_usn", index))
    
    WebUI.setText(findTestObject('Page_Login/txt_Password'), data.internallyGetValue("demo_pwd", index))
    
    WebUI.click(findTestObject('Page_Login/btn_Login'))
    
    WebUI.verifyElementPresent(findTestObject('Page_CuraHomepage/btn_MakeAppointment'), 0)
    
    WebUI.closeBrowser()
}

The variable named “index” above seems to be what you call “data iteration value”. Am I right?

Yes, I saw that post. However the ‘Index’ is a variable that you are creating and can assign whatever value you want.

When using Data Binding (for Test Suites) you assign the data file and give it the rows you want to use in that file. Is there a way to access those values within a Test Case code ?

The “Data Iteration” column in theTest Data dialog — I have never been aware of it. This is my first time to look into it. The “Data Iteration” column seems to be designed to provide user a chance to specify the range of rows for a Test Suiite to select out of the given data source.

I looked at the Katalon Studiio’s Javadoc. I could not find any methods/properties that exposes the “Data Iteration” setting to users.

I guess, the “Data Iteration” setting (e.g, Run from row “1” to row “3”) is accessible for only Katalon Studios engine (something named TestSuteRunner). The setting is not supposed to be used by user’s Test Case scripts.

Thanks for the info. Shame I can’t access the Data Iteration value. :frowning:

Also glad I could help you learn something about running specific rows with that value.