5

Our team is developing a web service (C#, EF 6, Code first with existing DB). The database is developed and maintained by another team. We cannot make any changes to the database.

I'd like to test our app against the real database schema to ensure that our code is compatible with the changes made by the database team. I order to achieve that, I'd like to avoid doing changes (eg automated schema changes made by Migrations) to the test database schema.

I'd like to delete the real data and insert test data instead to make tests more reliable.

How to achieve that? I am using EF 6.0.

Would you recommend doing it in the following way?

  • Once day an automated job restores a copy of the real DB on a test server and run a SQL script to delete all the data (https://stackoverflow.com/a/156813/1131855).

  • When user starts the integration tests, the test initialiser deletes the data from the test DB and inserts the seed data. Then the integration tests run.

Community
  • 1
  • 1
Maxim Eliseev
  • 3,248
  • 4
  • 29
  • 35
  • These answers might be useful: http://stackoverflow.com/a/13951747/1131855, http://stackoverflow.com/a/13857240/1131855 – Maxim Eliseev Jun 04 '14 at 14:25

0 Answers0