Forum Discussion

jhall68w's avatar
jhall68w
Contributor
4 years ago
Solved

Verifying on screen contents by comparing DB to UI

We have 4 different environments, with each environment having multiple databases.

Each database could/will have different data, but all in the same structure

 

What I am trying to do is find a way (no matter what environment/database) I am using that when I am verifying the UI contents, I can directly test that against the database to make sure the tables are populating correctly.  Verifying single values has not been an issue, but verifying a complete table has become difficult as I am not looking at the same database each test. 

 

A SQL table example could be like this, and this is what I want to verify is against what is displaying on the UI.

ItemAbbreviationCount
item1IT123
Item2IT211
Item3IT331

 

I am not sure if I can use the Stores>DB Tables as it does not seem those can by dynamic, so I am stuck in 1 environment and 1 database. I am also not sure if I can create a new DB Table project variable that can store the query results in a format that I can compare either.  Instead of recreating the wheel, I am looking for insight on if, and what others have found to be the best way to go about this.

 

Below is an example of what I am doing for a Single value.

 

function GetItemCount()
{
var Qry;

Qry = ADO.CreateADOQuery();

Qry.ConnectionString = "my connection string"

Qry.SQL = "SQL Count(*) Statement"

Qry.Open();

Qry.First();

Project.Variables.Item_Total = Qry.FieldByName("Count").value;

Log.Message('Current Item count is ' + Qry.FieldByName("Count").value);

Qry.Close();
}

  • I would do it this way (but written in your code)

     

    For each line in the database

        read the SearchItem info

        for each item on the UI

              add one to UICount if item = SearchItem

        compare UICount to SearchItemCount to verify

     

    If each of your databases have the same structure and the UI is the same, then this should work for any of them

     

2 Replies

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    I would do it this way (but written in your code)

     

    For each line in the database

        read the SearchItem info

        for each item on the UI

              add one to UICount if item = SearchItem

        compare UICount to SearchItemCount to verify

     

    If each of your databases have the same structure and the UI is the same, then this should work for any of them

     

    • sonya_m's avatar
      sonya_m
      SmartBear Alumni (Retired)

      Nice advice Marsha! Thank you.

       

      jhall68w Does this approach work for you?