I want to validate against my DB from test studio

2 posts, 0 answers
  1. Rad
    Rad avatar
    3 posts
    Member since:
    Jul 2018

    Posted 18 Jul 2018 Link to this post



    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?



  2. Elena
    Elena avatar
    1108 posts

    Posted 23 Jul 2018 Link to this post

    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! 

    Elena Tsvetkova
    Progress Telerik
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
Back to Top