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

Find content of elements and comparing to SQL query

4 Answers 80 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 28 Jan 2015, 02:37 PM
Hi

I'm working on a project that requires me to check figures in various reports (Silverlight and SSRS).

I have a dashboard SSRS report that shows various subreports, for example Top 10 Users, which shows names and spend(£). I would like to access those 10 names and their respective figures and then run a SQL query to check they match.

I have set up the SQL connection and that is pulling the data out that I need, but I'm struggling to work out the best solution to capturing the data from the report.

Can you please help?

Many thanks

Andrew

4 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 28 Jan 2015, 11:55 PM
Hello Andrew,

Where/how did you setup this SQL connection?

One approach I'm thinking you can take is to setup a data driven test. The test uses a SQL DB data source and uses that data to compare what's displayed in the browser. Would something like this work?


Regards,
Cody
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Andrew
Top achievements
Rank 1
answered on 29 Jan 2015, 09:04 AM
Hi Cody

Thanks for your reply.

I have set up the SQL connection as a coded step using: http://docs.telerik.com/teststudio/advanced-topics/coded-samples/general/access-sql-database Read from a SQL Database.

The report I am scripting for has seven subreports that display different data in one dashboard (SSRS).

My queries will return 5 or 10 pairs (i.e. name and amount). I'd like to be able to locate those values in the report (I have a test for each subreport), iterate over them and compare to the SQL query. (I'll post again to finish this off)







0
Andrew
Top achievements
Rank 1
answered on 29 Jan 2015, 09:09 AM
I have been able to locate the html class for each subreport and the XPath, so I was thinking that I could use either
Find.AllByExpression() or Find.AllByXPath() loop over those and compare to the SQL.

I'm just not sure the best way to achieve this.

I'll have a look at your suggestion for a data driven test, but would that handle multiple results in one hit?

Thanks Andrew

0
Cody
Telerik team
answered on 30 Jan 2015, 02:18 AM
Hi Andrew,

With the data driven approach I suggested, you would want your SQL query to return just one row of data. Each cell in that row can be compared to one piece of data displayed in the UI.

It would not work very well if the SQL query returns multiple rows of data. Test Studio will want to compare each column of data to the same UI element displayed in the browser N times, where N = number of rows of data returned by the SQL query. Thus the test would run N times comparing each column to just one UI element during each iteration.

I'm not even sure if Find.AllByExpression() or Find.AllByXPath() would work very well. This approach would only work if the expression is unique enough to get only the correct set UI elements to compare against, and all of these UI elements are contained in the DOM at once. If you have to click something to move from report A to report B in order to bring the UI element into the DOM so you can fetch it, then Find.AllByXXXX won't work since it can only fetch what's currently in the DOM.

However if you actually can get all the UI elements to validate all at once with Find.AllByXXXX, then yes using code you could iterate through the UI elements returned and compare them to the data set returned by your SQL query done in code.

Regards,
Cody
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Andrew
Top achievements
Rank 1
Answers by
Cody
Telerik team
Andrew
Top achievements
Rank 1
Share this question
or