Scripted database checkpoints - best practices
- 8 years ago
What I've done in the past is use the ADO object to create my own custom SQL queries. These I would then execute against the SQL database to retrieve the required data. Verification of that data would depend upon what it is I need to be looking for. If I'm just querying for a single value, then it's a simple comparison of the result of the query to the baseline value, either parameterized from another function or retrieved from a data record in a data-driven framework structure.
If I need to compare a whole table, what I've done in the past is created my baseline as a CSV file that I store with the rest of my automation source code. The SQL query then returns an ADO RecordSet which I loop through along with the CSV file and do a comparison of the data in the record set with the data in the CSV file.
For doing custom queries, variable connection strings, etc., this is what I would do.
To assist you, I do have a script extension I created a bit ago that encapsulates a lot of the SQL query code so you don't have to write it yourself. If you're interested, check the link in my signature.