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

Get Values of data bound SQL Table in recordset

2 Answers 71 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Rahul
Top achievements
Rank 1
Rahul asked on 10 Jun 2014, 06:07 AM

Hello Team

I have bound an SQL Table to 2014.1 standalone test studio version.

I want to compare programatically the values in rows retrieved as record set [selcting a single column header with two active rows]

C sharp Code using CurrentDataRow method worked OK for iterations of bound recordset but I cannot do a comparison, as value retrieval that happens in iteration 1 has no scope in Iteration 2.

Is there a workaround to get both the row values as record set in same step and perform a comparison ?

2 Answers, 1 is accepted

Sort by
0
Rahul
Top achievements
Rank 1
answered on 11 Jun 2014, 10:52 AM
Hello

As a workaround, inorder to get SQL record set in coded step I used the standard code base suggested in Tool documentation.
Even after giving sufficient connection time out in connection string sometimes randomly my query fails with error below


System.Data.SqlClient.SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.) ---> System.ComponentModel.Win32Exception (0x80004005): An existing connection was forcibly closed by the remote host at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)

Am I missing something important here ?
0
Cody
Telerik team
answered on 12 Jun 2014, 09:52 PM
Hi Rahul,

Regarding the error "System.Data.SqlClient.SqlException" I'm afraid this is completely outside of Test Studio and beyond our ability to help. We can help with any Test Studio API call but we know only the very basics for making direct SQL calls like that. We have no clue what could possibly cause the error you are getting.

Now let's address your automation challenge. If I understand the problem correctly, you have a data table in SQL in which you'd like to compare those values to the values displayed in a table in a browser window, is that true?

You are right in that each iteration of the test you will only get one row of data (the next row) from the SQL table, which in the browser you have the entire table displayed all at once. You could take one of two approaches:

1) Do what I think you've started to do... don't make it a data driven test, but use code to fetch the entire SQL table all at once and iterate through all the rows comparing the data as you go alone.

2) In code you can determine the current iteration number of a data driven test by getting:

Data.IterationIndex

This will start at 0 for the first iteration and increment by one for each iteration. You can use the iteration value to determine which row of data displayed in the browser is the right row to compare.

I hope that helps.


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