Programmatic Database query with Katalon
As mentioned previously, making dynamic database queries was a big goal for this year. Katalon makes this quite easy with a UI to set up the connection and a straightforward way of connecting to the data itself. To start the process, select Data Files, New Test Data and select Database as the source. Taking the configuration string from before, we connect to the database using this screen and provide the default query. This creates a default table of data that Katalon will work with when executing tests. Within our code, we use the TesData object to get at our database source. TestData inventoryDB = findTestData(‘Data Files/database object name’) We can now get the number of rows in the database, the names of the columns and read data from each column as needed. We need to reference each column with an index number rather than it’s name. Even though Katalon displays “item_number” as the column title, internally that is column 1. […]
Recent Comments