Hello Team,
I am trying to use a database connection to work with test data. I was able to create a database connection but when I run the steps I am not getting an expected output.
=================================================
Here is the script I have:
import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import internal.GlobalVariable as GlobalVariable
CustomKeywords.‘database.DB.connectDB’(‘katalon-studio-test-database.uquwiowhwowt.us-west-10.rds.amazonaws.com’, ‘katalon_qa_database’,
‘3306’, ‘qa_automation’, ‘uqiquiqyqtqyqu’)
first_name = CustomKeywords.‘database.DB.executeQuery’(‘SELECT FirstName FROM FirstNameLastName ORDER BY RAND() LIMIT 1;’)
test = WebUI.concatenate((([first_name]) as String))
WebUI.comment(test)
CustomKeywords.‘database.DB.closeDatabaseConnection’()
==================================================
I am expecting that this should return a string but instead, I am getting com.mysql.jdbc.JDBC42ResultSet@73dce0e6
The custom keyword I created is from https://docs.katalon.com/katalon-studio/tutorials/connect_db_gui_testing.html