Forum Discussion

habhoub's avatar
habhoub
Occasional Contributor
8 years ago

Hello, i want to ask is it possible to compare a db table store with a table store??

i have a windows application, very complicated.

I want to start simply by comparing a list of data displayed in a tab with the real data in the database table.

I was thinking what is the best solution: table checkpoint or db table checkpoint?? i'm lost...

I want to compare this list to the real data in a sql table.

Can i create one table checkpoint with live data and another one a db table checkpoint with the content of the sql table and then compare them to each other??

 

Thanks for your help

  • Correct, there is no way of creating a table in the stores via script... that's kinda what I was implying that, to do what you want to do, you'll need to use a different methodology than the Tables checkpoints.  Roughly pseudo-code (not tested, not runnable):

    SQLDataSet = SQLQuery.Open(sqlQueryString);
    OnScreenTableObject = Aliases.myApp.myTable;
    for (var i = 0; i < OnScreenTableObject.RowCount; i++){
        if (SQLDataSet.EOF) break;
        for (var j = 0; j < OnScreenTableObject.ColumnCount; j++){
            Compare(SqlDataSet.Field(j), OnScreenTableObject.Cell(i, j));
        }
        SQLDataSet.NextRow();
    }

     

    So, you loop through you're onscreen table and compare, cell by cell, row by row, and compare the contents.  I kinda shortcutted in the pseudo code to imply that there's a "compare" routine that compares the two.  This is the best way I know of to do the kind of comparison you need to do where the data being compared between SQL and the onscreen data changes from run to run.  There are probably some other minor techniques that can be applied (using DDT driver, storing the SQL data into a table variable and then doing the comparison, etc) but, for what you want to do, a table checkpoint is not going to work for you.

  • Hi,

    Could you be more specific. What is your "tab" ? ("list of data displayed in a *tab*") Is it a grid ?

    And the application is written with ...?

    • habhoub's avatar
      habhoub
      Occasional Contributor

      Hello 

      Thanks for your reply.

       

      Data is displayed in Telerik listview.

      Application is written in VB.NET

      I'm using VbScript in TestComplete. 

      My test case is to just verify this list of data displayed in the listview. This data is read from only one column of a table. 

      If i want to use table checkpoint, i was wondering if it's possible to read the real data from SQL DB into the table checkpoint, in order to check it with the live data displayed in listview control. Because otherwise, i can't use this solution as the data is not fix in my application to always compare same values with live data. 

      Hope i'm clear now, thanks for yor help i'm very new in TestComplete and i want someone fluent in it responding to my questions.

      Another question: is it possible to create the table checkpoint via script not via recording? 

       

      Thank you

       

       

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        habhoub wrote:

        Hello 

        Thanks for your reply.

         

        Data is displayed in Telerik listview.

        Application is written in VB.NET

        I'm using VbScript in TestComplete. 

        My test case is to just verify this list of data displayed in the listview. This data is read from only one column of a table. 

        If i want to use table checkpoint, i was wondering if it's possible to read the real data from SQL DB into the table checkpoint, in order to check it with the live data displayed in listview control. Because otherwise, i can't use this solution as the data is not fix in my application to always compare same values with live data. 

         

         


        Answering the first question... no, you can't update the table checkpoint from the SQL DB during runtime.  The checkpoint data is stored statically and is used for the comparison.  What I would do here is run the SQL query to retrieve the data from SQL and then write script code to iterate through the rows of the onscreen table and compare them with the corresponding records from the retrieved SQL RecordSet.  That will ensure that you're comparing the data based upon the current SQL.

         


        habhoub wrote:

         

        Hope i'm clear now, thanks for yor help i'm very new in TestComplete and i want someone fluent in it responding to my questions.

        Another question: is it possible to create the table checkpoint via script not via recording? 

         

        Thank you

         

         


        I think my answer above answers this one... yes, you can do checkpoints via script... anything can be done via script without having to "record" things.  However, in your specific circumstances, because the contents of the onscreen table and the contents of the SQL database are variable from run to run, this is going to require you to write a custom comparison routine.