Database-Dependent Testing

2 posts, 0 answers
  1. Brian Mains
    Brian Mains avatar
    485 posts
    Member since:
    Oct 2008

    Posted 27 Nov 2011 Link to this post


    I would like to use Test studio to record some of my tests; however, what I need to figure out is that I need to be able to, when TestStudio starts, get my database into an initial state of data for the test; essentially, as I run my tests, everytime I need to start the test project, I need to have the database at a particular state.  Have you guys got any tips for accomplishing this?  I'm using the MS test framework for unit tests.

  2. Anthony
    Anthony avatar
    19 posts

    Posted 30 Nov 2011 Link to this post

    Hello Brian Mains,

    You have a few options depending on how you "get your database into an initial state."

    1. Test as Step - If your database can be restored through your web application, then record a test that does this. Then call this test from within another test via the Test as Step feature.
    2. Coded Step - Insert a coded step and write code to accomplish your task. Here is a page with a few suggestions, such as swapping the data file on disk.
    3. Custom Script Before Test Run - Insert code into the OnBeforeTestStarted() method to restore your database before the script starts.

    Best wishes,
    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
Back to Top