Verify results against the Database...?

4 posts, 0 answers
  1. John
    John avatar
    2 posts
    Member since:
    Jul 2011

    Posted 22 Jul 2011 Link to this post


    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?

  2. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 25 Jul 2011 Link to this post

    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?
  3. John
    John avatar
    2 posts
    Member since:
    Jul 2011

    Posted 25 Jul 2011 Link to this post

    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?







  4. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 26 Jul 2011 Link to this post

    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?
Back to Top