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

From telerik to Oracle/Sql db for data

10 Answers 280 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
wish
Top achievements
Rank 1
wish asked on 23 Aug 2011, 01:23 AM
Hi Cody,

My management is intrested to design test case as follows:

Create a test case as per UI design need, and perform some search criteria and which returns some number of records from database and display it to the user along with number of rows information.

What actually they need is, during the steps in the test case, is it possible to connecting sql/oracle db to get data for the similar criteria and number of records information and need to compare with UI display data.

Is it possible to write a code to conenct to db from test cases to compare data??

Please help me here...

Thanks.,
Hari

10 Answers, 1 is accepted

Sort by
0
wish
Top achievements
Rank 1
answered on 23 Aug 2011, 02:31 AM
Hi Cody,

I can able to connect successfully for sql server.. but am facing issues while connecting to oracle db....as my req is to connect to oracle.

while adding datasource....i hav selected oracle client data provider...given appropraite connection string to connect...but still connection is throwing us error...

as i observed the google that, do i need to have oracle client installation and ODAC for .net is needed for connecting to oracle ????

pls help me here in giving approp suggestions...

Thanks.,
Hari
0
Cody
Telerik team
answered on 23 Aug 2011, 07:17 PM
Hello Wish,

Are you attempting to data drive your test? It sounds like you want to compare what is displayed in the UI from a search with the contents of your Oracle DB, and I suspect the returned search results can be many. Data driven testing is good for providing input into a test, one row at a time. The test will execute once for each row of data.

This approach does not fit in the verification scenario where multiple results need to be verified in a single pass. If I have misunderstood your testing requirements, please correct me.

For this I would use a pure coded step that connects to my DB, extracts the data out of it to be compared, extracts the data from the UI to be compared, then performs that comparison by iterating through the data just extracted from the DB, displaying the results and/or failing the test if it does not compare correctly.

A quick Google search shows these results for how to connect to an Oracle DB from C# code:

http://omegacoder.com/?p=445
http://msdn.microsoft.com/en-us/library/xexk8kx3(v=VS.90).aspx
http://www.codeproject.com/KB/database/C__Instant_Oracle.aspx
http://www.java2s.com/Code/CSharp/Database-ADO.net/OracleconnectionstringforC.htm
http://itsrashid.wordpress.com/2007/05/25/using-oracle-database-with-c/

We don't have an Oracle DB to test against, so we can't really assist writing such code.

Greetings,
Cody
the Telerik team
Vote for Telerik Test Studio at the Annual Automation Honors Voting!
0
wish
Top achievements
Rank 1
answered on 24 Aug 2011, 12:47 AM
Thanks cody for your reply..

Iam done with by connecting to oracle database from adding databind to test script or case using oracleclient data provider successfully.

its really cool having such a great feature with simple connection string helped me to connect to oracle db data fetched

Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=hostname)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=sidname)));User Id=username;Password=pwd;

Thanks again for great feature with simple work...

I just need few suggestions on my approach.

1. Assume, a silverlight app developed and hosted on 3 different machines which refer 3 different dbs

http://machine1 and its db is oracle present on server "dev"
http://machine2 and its db is oracle present on server "smoke"
http://machine3 and its db is oracle present on server "checkit"

i added a xls file having these 3 urls of with uid, pwd like
url    uid     pwd

i binded it to my test case or script and hence when i execute it takes one url from xls and using corresponding uid n pwd logins and executes search functionality.

my req:

i want to verify the search results like count of records w.r.t to their database.

do we have options of multiple data binds to same test script or case.????

for my test scripts or cases project, i added one xls file having above urls with uid n pwds info and three databinds with above dbs connections info...

how could i sync for each url corresponding db fecthing results should compare????

please help.....

Thanks.,

Hari

0
Cody
Telerik team
answered on 25 Aug 2011, 12:04 AM
Hi Wish,

I can think of a few approaches to solve this problem:

1) Put all the data for each environment on one row in your Excel file (URL, user, pw, db server name). Then use the "Filter Data Between Rows" feature to a specific row of data as shown in the attached screen shot. Using this approach is a data driven test and your inputs, including the hostname comes from the data source.

2) Have 3 parent tests that are bound to 3 different data sources, one for each environment. They all call the same subtest which has Inherit Parent Data source checked.

3) Have 3 parent tests that have a coded step which sets the values to be used by the subtest. You do this with code like this:

SetExtractedValue("extractedID", area);
SetExtractedValue("URL", "http://dev");
SetExtractedValue("DBHost", "dev");
SetExtractedValue("UserID", "Joe Black");
SetExtractedValue("PW", "smitty");


Kind regards,
Cody
the Telerik team
Vote for Telerik Test Studio at the Annual Automation Honors Voting!
0
Andy
Top achievements
Rank 1
answered on 12 Oct 2011, 04:04 PM
Hi Cody,

Our testers are more familiar with Visual Basic - would you have any insight to connecting to Oracle from a Test Studio Script using more of a VB coding solution?

Basically, we need to connect to one or more databases and execute a SQL query to get test data that we would drive into the test. In reviewing your C# examples from this forum conversation, it sounds like functionally it can be done. I just need some help putting it together.

Thanks,
Andy
0
Cody
Telerik team
answered on 12 Oct 2011, 09:27 PM
Hi Andy,

We don't have any Oracle sample code, mainly because we don't have an Oracle server. A quick Google search on "how to connect to oracle using vb.net" came up with this page:

http://www.startvbdotnet.com/ado/oracle.aspx

SetExtractedValue is available in VB.NET using the exact same parameters. Just leave off the trailing ; character. That's the only difference in the code sample of my previous post.

All the best,
Cody
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Kavita
Top achievements
Rank 1
answered on 17 Nov 2011, 08:17 PM
Hi Cody,

Can you please give directions to connect to a sql server database? I am trying to connect to the database using the Script Step and everytime I execute it, it gives me an error.
Please help.

Thanks.
0
Cody
Telerik team
answered on 21 Nov 2011, 07:47 PM
Hello Kavita,

We created this new code sample showing how to connect to a SQL database in code. Does this help?

Best wishes,
Cody
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Kiran
Top achievements
Rank 1
answered on 11 Jun 2012, 12:17 PM
0
Kiran
Top achievements
Rank 1
answered on 14 Jun 2012, 01:25 PM
Pls ignore my previous post.
Tags
General Discussions
Asked by
wish
Top achievements
Rank 1
Answers by
wish
Top achievements
Rank 1
Cody
Telerik team
Andy
Top achievements
Rank 1
Kavita
Top achievements
Rank 1
Kiran
Top achievements
Rank 1
Share this question
or