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

I want to validate against my DB from test studio

3 Answers 259 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Rad
Top achievements
Rank 1
Rad asked on 18 Jul 2018, 03:30 PM

Hello,

 

Here is what I am trying to accomplish.

 

In my web AUT, I am creating a service ticket which is Data driven and has say 2 rows ( Right now just using the local data instead of external). Once my service ticket is created, I am asserting the text content in the grid using the verification step. After this I would like validate if the record is present in the DB. I am successfully able to connect to my SQL DB from test studio (Found a code sample in your forum which is great). Basically my query is to retrieve the service ticket by running a select statement and comparing this against the UI element. How do I do this using a coded step? I need to able able retrive the rows from my test and use that in my query and run a compare between the two?

 

Thanks!

3 Answers, 1 is accepted

Sort by
0
Elena
Telerik team
answered on 23 Jul 2018, 10:25 AM
Hi Rad,

Thank you for the detailed description! 

If you would like to stick to the built-in data table solution you could use extraction steps to get the value from screen you have verified with the data source. This could be also implemented in an if..else statement if necessary. The extraction to variables could be also completed in a coded step in case you decide to go for a complete coded solution. This is the valid approach if you are about to use the local data source as there is no way to access the grid itself. 

On the other hand if using an external data source, like Excel for example, you could read the values from it to compare them with the entry returned by the call towards the database. Here is a sample article which demonstrates how to write to an Excel file but I guess will be helpful for you to understand how to interact with an external file. How to use the TestData class can be found here

I hope the shared information will be useful to you. Though in case of questions please let me know! 

Regards,
Elena Tsvetkova
Progress Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Dipti
Top achievements
Rank 1
answered on 20 Sep 2019, 01:22 PM

Hi Elena, 

I need a solution, that how we can validate the database and Web UI, as the data on Web is dynamic and changes continuously after every 4 hours.

 

0
Elena
Telerik team
answered on 20 Sep 2019, 02:48 PM

Hello Dipti,

Since the values in the application you are testing are dynamic, the best approach will be to use extraction steps to get the current value of an element. Then, you can use that extracted variable in code to build the comparison to your database. That way, the dynamic values will be taken each time during the test run and will store the actual value at that time. 

I hope this will be useful for you. 

Regards,
Elena
Progress Telerik

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