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

Database-Dependent Testing

1 Answer 102 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Brian Mains
Top achievements
Rank 1
Brian Mains asked on 28 Nov 2011, 04:41 AM
Hello,

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.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Anthony
Telerik team
answered on 30 Nov 2011, 06:19 PM
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,
Anthony
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
Tags
General Discussions
Asked by
Brian Mains
Top achievements
Rank 1
Answers by
Anthony
Telerik team
Share this question
or