This is a migrated thread and some comments may be shown as answers.

Verify results against the Database...?

3 Answers 175 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 22 Jul 2011, 10:13 PM

Question...

I have a search page that returns rows displayed on the web page by a default filter…  I want to verify the number of results on the page is the same number of results returned when I query the database.  How is this done using your tool?

3 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 25 Jul 2011, 03:01 PM
Hello John,

There are many ways to do this depending on your exact scenario and most of all how theresults are displayed. In some cases it could be pretty simple to make this verification if the control provides such functionality. For example if you are using a "RadGrid" the number of the results can be displayed as shown in the attached screenshot.

In other cases we have to locate the parent element which contains the results in the DOM explorer and write a coded step. I am attaching a simple test project showing how to verify the number of results from a Google search. In "resultCount" I'm keeping the number of the child nodes from the search. And then I make a check if it is equal to "2".
int resultCount = Pages.TelerikSilverlightRadgrid.RsoOrderedList.ChildNodes.Count;
Assert.AreEqual(2, resultCount);
See the attached sample and let me know if you have any further questions!

 
Regards,
Plamen
the Telerik team
Register today for a live 'What's New in Test Studio R1 2011 SP2' event on Tuesday, July 19 at 2pm EST!

Have you looked at the new Online User Guide for Telerik Test Studio?
0
John
Top achievements
Rank 1
answered on 25 Jul 2011, 11:14 PM

Thanks for your suggestions, the attached screen shot may help me explain more clearly ...the red box around the target element is an example of one of the rows that I want to count on the page ...I want to bind a query to verify against the DB (which currently returns a count of 134 ) that  the number of rows that are counted on the page should equal 134… what are the steps to make this type of verification?







0
Plamen
Telerik team
answered on 26 Jul 2011, 02:55 PM
Hello John,

For the first suggestion, you have to select the verification step and use the binding expression $(PATNO) in the "Bindings" property(see screenshot). 

For the second, your code should look like this:
int resultCount = Pages.TelerikSilverlightRadgrid.RsoOrderedList.ChildNodes.Count; 
Assert.AreEqual(Data["PATNO"], resultCount);
Hope this helps! 

Best wishes,
Plamen
the Telerik team
Check out the Test Studio roadmap to find out more about the new performance testing functionality coming in our R2 2011 release this September!

Have you looked at the new Online User Guide for Telerik Test Studio?
Tags
General Discussions
Asked by
John
Top achievements
Rank 1
Answers by
Plamen
Telerik team
John
Top achievements
Rank 1
Share this question
or