cancel
Showing results for 
Search instead for 
Did you mean: 

Verifying on screen contents by comparing DB to UI

SOLVED
Highlighted
Contributor

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();
}

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: Verifying on screen contents by comparing DB to UI

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

 

View solution in original post

2 REPLIES 2
Highlighted
Community Hero

Re: Verifying on screen contents by comparing DB to UI

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

 

View solution in original post

Highlighted
Community Manager

Re: Verifying on screen contents by comparing DB to UI

Nice advice Marsha! Thank you.

 

@jhall68w Does this approach work for you?


Sonya Mihaljova
Community and Education Specialist

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!

Challenge Status

How to execute remote test and obtain results via Test Runner REST API

Participate!

Comparing content of HTML table with Excel file data

Participate!

Compare HTML table with Excel file and correct data in the file

Participate!

Retrieve Data from a Web Page

Participate!
Top Kudoed Authors