Forum Discussion

dust258's avatar
dust258
New Contributor
6 years ago

Table Checkpint in a Data-Driven Loop

I would like to convert one of my KeywordTests into a data driven loop. I added a loop using an Excel worksheed as Source which works fine.

Inside the loop I need to create a Checkpoint to review the data inside a TDBGrid (Delphi Grid Control). The Checkpoint currently points to a Table. Is it possible to load the content of the table dynamic inside of the loop? What are my options to add Checks on table data inside of a Data-Driven Loop?

My first idea was to create a script to write the check-data from the excel file into the Store-Table. Is there a better way?

  • tristaanogre's avatar
    tristaanogre
    6 years ago

    Table checkpoints are tricky because you are comparing contents to contents of the WHOLE table all at once.  And the table that you have as a baseline is stored as an object in a collection.  So, you are talking about doing a checkpoint of a table that is dynamically changing each time through the loop against "static" objects.

    Now... the Table object itself DOES have Values properties that you can set dynamically through the test run.  You would need to write code to read the expected values out of some file and populate the values in the table object.  You're going to have to work with the properties available https://support.smartbear.com/testcomplete/docs/reference/project-objects/items/stores/table/values.html to first update your baseline with the expected values before you do the comparison.... and each time through the loop, you'll have to repeat this update.

    Rather than using the built in table checkpoint, I'd work on writing a custom Script routine to basically do the comparisons directly rather than using a checkpoint.

     

    Alternatively, you could create a baseline table corresponding to each time through the loop and then, using a code snippet, do an "eval" of the object, passing in the name as a variable.  But his feels clunky to me.

4 Replies

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      Table checkpoints are tricky because you are comparing contents to contents of the WHOLE table all at once.  And the table that you have as a baseline is stored as an object in a collection.  So, you are talking about doing a checkpoint of a table that is dynamically changing each time through the loop against "static" objects.

      Now... the Table object itself DOES have Values properties that you can set dynamically through the test run.  You would need to write code to read the expected values out of some file and populate the values in the table object.  You're going to have to work with the properties available https://support.smartbear.com/testcomplete/docs/reference/project-objects/items/stores/table/values.html to first update your baseline with the expected values before you do the comparison.... and each time through the loop, you'll have to repeat this update.

      Rather than using the built in table checkpoint, I'd work on writing a custom Script routine to basically do the comparisons directly rather than using a checkpoint.

       

      Alternatively, you could create a baseline table corresponding to each time through the loop and then, using a code snippet, do an "eval" of the object, passing in the name as a variable.  But his feels clunky to me.

      • TanyaYatskovska's avatar
        TanyaYatskovska
        SmartBear Alumni (Retired)

        Thanks for the help, tristaanogre.

        dust258, did the previous reply answer your question?