Forum Discussion

srandall's avatar
srandall
Contributor
8 years ago
Solved

Data-driven test and verifying modified values

I have a test case where the input values I am using are database driven; therefore I have a sql query where I am looking for accounts in a specific condition. Therefore, I'm not guaranteed the same account will be used each time I run the test since the specific condition could change at any time (which is exactly what I want for this portion of the test). This part is working fine, I am able to create my checkpoints and confirm the data that I am looking at and the data in the table match. 

 

However, what I want to do now is change that data, save it and verify the value I changed it to is now stored in the database along with some other values that automatically change when I set a value to something specific. I am having trouble with understanding how I can do that.

 

I understand there is a Database Table Checkpoint, but I'm having trouble with creating that. (When I select the table, then select the columns I need to compare, it just sits and churns and it eventually makes me shut down the TestComplete app).  

 

What are the recommended steps to pull certain data from the database, change the data, then verify the changed data (and all other fields it affects) gets updated as expected? I'm churning my wheels on this one. I'm not sure how to reference back to that same account so I know I'm comparing the data for the account I actually changed. 


  • srandall wrote:

    I have a test case where the input values I am using are database driven; therefore I have a sql query where I am looking for accounts in a specific condition. Therefore, I'm not guaranteed the same account will be used each time I run the test since the specific condition could change at any time (which is exactly what I want for this portion of the test). This part is working fine, I am able to create my checkpoints and confirm the data that I am looking at and the data in the table match. 

     

    However, what I want to do now is change that data, save it and verify the value I changed it to is now stored in the database along with some other values that automatically change when I set a value to something specific. I am having trouble with understanding how I can do that.

     

    I understand there is a Database Table Checkpoint, but I'm having trouble with creating that. (When I select the table, then select the columns I need to compare, it just sits and churns and it eventually makes me shut down the TestComplete app).  

     

    What are the recommended steps to pull certain data from the database, change the data, then verify the changed data (and all other fields it affects) gets updated as expected? I'm churning my wheels on this one. I'm not sure how to reference back to that same account so I know I'm comparing the data for the account I actually changed. 


    Not sure why you're having the problem you're having creating a Database Table Checkpoint.  I personally don't use them because my SQL queries tend to be a bit more complex than a simple table comparison. That, and the data I want to compare is dynamic from run to run... kind of like you where one test run you'll be working with one set of accounts, the next time you run, it will be a different set.  The DB Table checkpoint is more on static, repeatable data without the potential for dynamic information.

     

    I would simply use ADO objects and queries to do the checks, probably what you're doing for your initial queries. Run a query to retrieve the altered data as a RecordSet, use a "while" loop to loop through that record set and check for your changed values.

3 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    srandall wrote:

    I have a test case where the input values I am using are database driven; therefore I have a sql query where I am looking for accounts in a specific condition. Therefore, I'm not guaranteed the same account will be used each time I run the test since the specific condition could change at any time (which is exactly what I want for this portion of the test). This part is working fine, I am able to create my checkpoints and confirm the data that I am looking at and the data in the table match. 

     

    However, what I want to do now is change that data, save it and verify the value I changed it to is now stored in the database along with some other values that automatically change when I set a value to something specific. I am having trouble with understanding how I can do that.

     

    I understand there is a Database Table Checkpoint, but I'm having trouble with creating that. (When I select the table, then select the columns I need to compare, it just sits and churns and it eventually makes me shut down the TestComplete app).  

     

    What are the recommended steps to pull certain data from the database, change the data, then verify the changed data (and all other fields it affects) gets updated as expected? I'm churning my wheels on this one. I'm not sure how to reference back to that same account so I know I'm comparing the data for the account I actually changed. 


    Not sure why you're having the problem you're having creating a Database Table Checkpoint.  I personally don't use them because my SQL queries tend to be a bit more complex than a simple table comparison. That, and the data I want to compare is dynamic from run to run... kind of like you where one test run you'll be working with one set of accounts, the next time you run, it will be a different set.  The DB Table checkpoint is more on static, repeatable data without the potential for dynamic information.

     

    I would simply use ADO objects and queries to do the checks, probably what you're doing for your initial queries. Run a query to retrieve the altered data as a RecordSet, use a "while" loop to loop through that record set and check for your changed values.

    • srandall's avatar
      srandall
      Contributor

      'While Loop' !!!!! I would have never ventured to that possibility. Thank you, thank you!!!  It works beautifully!!!

    • srandall's avatar
      srandall
      Contributor

      I think I was a little pre-mature in saying this resolved my problem. What I am having difficulty with is understanding how I retrieve the 'altered' data and guarantee I am looking at the correct record with the most recent updates.

       

      I have attached a test case where I am query the database with a data-driven loop to get records in a specific condition. My next test case changes that data and I want to confirm the changed data has properly been stored along with some other changes I would expect to happen in the database. 

       

      So how do ' Run a query to retrieve the altered data as a RecordSet'?