Forum Discussion
Hi Alexander,
I am guessing that you do not understand the initial question. It was about changing the SQL request for a checkpoint on playback and not about dynamic SQL.
Nevertheless, please note that TestComplete does not have its own implementation of SQL at all. It just uses OLE DB providers registered in the system and, therefore, the available functionality is limited by these providers.
- mgroen28 years agoSuper Contributor
I am struggling with similar issue as well.
My scenario:
As a POC, I have created some simple Keyword Driven tests, which do the following:
1. start application;
2. add a Customer using the UI;
3. Close application;
I want to extend this test a step 4, which is a validation on the database. This validation should check whether the added customer has actually been written to the database. In this validation a simple SQL query would be enough for the moment. The SQL Query looks (simplified) as follows:
Select CustomerName, ID, Address
from Table.Customers
where CustomerName is "ENTERED_CUSTOMER_NAME".
The value "ENTERED_CUSTOMER_NAME" in the where clausule of the SQL statement, should match the value entered in the Keywordtest in the UI (step 2). And these values should be dynamically (read test data from Excel file).
The validation at step 4 should pass if the result of the query is > 0 (a record is found), and it should fail if no record is found (which would indicate the entered customer data does not exist in the database).
Question: is this possible with TestComplete? If so, could this be handled by Database Checkpoints or something?
- tristaanogre8 years agoEsteemed Contributor
This sounds like a DBTable checkpoint with the exception that you need a dynamic "WHERE" clause. So... I don't think this is available out of the box. However, you can do what you're asking using ADO objects such as ADO.CreateCommand. Build a common function where you pass in the fields you want, the table name, and the parameter for the "WHERE" clause and run the SQL query that way.
I'm currently in the middle of re-factoring my SQLUtilities Script Extension to be a bit more object oriented but, built into it, is a query for precisely that in the current version. Feel free to download and extract the code if you want to see how it's done. The link I posted above also gives an example of writing such code.- mgroen28 years agoSuper Contributor
tristaanogrefirst of all, thanks a lot for your feedback. I appreciate it.
I have to say I am a "QA- type of person", I approach my work based on how to assure quality, rather then focusing on development of scripts. It's a different approach.
Nevertheless, I will take a look athe ADO.CreateCommand info you provided and I will give it a try - If you don't mind I keep you posted on the progress.
Having said that, I would like like to see TestComplete improved by implementation of way to perform this kind of validation (this meaning easy Database validations) without the need of coding/scripting etc. (except the SQL statements if you like to see this as coding/scripting).
Next to that, I don't see the real benefit of the DBTable checkpoint, if, as in it's current implementation, there is no (dynamic) support for Where clausules. To be honest I consider that a shortcoming of DBTable checkpoint. As far as I can see now I can only implement SQL statements without dynamic Where clausules, right? I mean it's pretty basic feature that you can create a dynamic relationship the "where part" of the SQL statement to the data entered in the UI.
Thanks.
Related Content
- 12 years ago
- 6 years ago
- 10 years ago
Recent Discussions
- 4 days ago
- 4 days ago
- 7 days ago