Justin Harper said:
Thank you for your reply Anthony. That way does work for me and in certain scenarios, is the right solution.
However, in my current scenario, I want to just be able to access the result as a single variable for comparison. Is there a way to do this without having to create a Data file? I would like to just be able to do this within the scripting view of Katalon
This is a high level description of the test I am trying to do:
1. Login to application front end
2. Create an ‘order’
3. Get a unique ID/Order number
4. Query the database to check the order has been created correctly with unique id
5. Make changes to the order in the application front end
6. Query the database again to make sure updates have been committed correctly
So something like
CustomKeywords.'customMethods.DatabaseMethods.connectDB'('serverAddress', 'TableName', '1433', 'username', 'password')
String queryResult = CustomKeywords.‘customMethods.DatabaseMethods.executeQuery’(‘SELECT STATUSDESCRIPTION FROM dbo.RASPOTSTATUS WHERE SPOTSTATUSID = 15’)
CustomKeywords.‘customMethods.DatabaseMethods.closeDatabaseConnection’()String expectedResult = “Update”
//Then compare queryResult against expectedResult and pass/fail the test based on this
Does that make sense?
Yes, that makes sense and is simular to what I was trying to acheive when I first posted.
But I did not know how to deal with the results, leading me to use the data file as a quick and simple work around.
Anyway here: https://dzone.com/articles/how-to-perform-database-testing-using-katalon-stud is what I used as an example to script my SQL connection and query, hopefully this will help you.
If you can figure out how to deal with query results as variables please share, it would be useful.