I want to validate against my DB from test studio

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

    Posted 18 Jul 2018 Link to this post

    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!

  2. Elena
    Admin
    Elena avatar
    1152 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! 

    Regards,
    Elena Tsvetkova
    Progress Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  3. Dipti
    Dipti avatar
    3 posts
    Member since:
    Mar 2019

    Posted 20 Sep in reply to Elena Link to this post

    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.

     

  4. Elena
    Admin
    Elena avatar
    1152 posts

    Posted 20 Sep Link to this post

    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!
Back to Top