c# - SQL Server Application - Resetting database to original state -
background
i need write integration tests in c# (about 120 of them) c#/sql server application. now, before test, database there, reason there because lot of scripts run set (about 20 minutes running time). when run test, few tables updated (crud operations). e.g. in 10-11 tables, few rows added , in 15-16 tables, few rows updated , in 4-5 tables few rows deleted.
problem
after every test run, the database needs reset it's original state. how can achieve that?
bad solution
after every run of test, re-run database creation scripts (20 minutes of running time). since there around 120 tests, comes 40 hours not option. secondly there process has several connections open against database database cannot dropped/re-created.
good solution?
i know if there other way of solving problem? problem have that, each of tests, don't know tables updated , have manually go , check see tables updated anyway if delete, revert database it's original state manually writing queries.
you should take @ possibilities mssql gives taking snapshot of database. potentially lot faster reverting backup or recreating database.
in testing environment, can useful when repeatedly running test protocol database contain identical data @ start of each round of testing. before running first round, application developer or tester can create database snapshot on test database. after each test run, database can returned prior state reverting database snapshot.
Comments
Post a Comment