Question

We have a huge application that contains

  • Web Layer - MVC
  • Service Layer - Web API
  • Domain Layer
  • DB Layer - EF 5 Code First

we wrote hundereds of unit test to avoid further problems. Now we want to write Integration Tests against database.

Until now we have been using xUnit for unit tests. But i couldn't be sure how can we go forward and i have some questions.

  1. Do you suggest to write one approach to "Top to Bottom" integration test. So writing a test method that uses MVC action that go through all layers and affect database or splitting to parts like Web - API, API - DB?
  2. I searched for xUnit about Fixtures but i couldn't find a sample of using IUseFixture against Entity Framework.
  3. We are using Code First migrations, so i think initializing database will be easy, because all migration files are at our hands. But how can i use them to create test database?
  4. Our team consists more than one developer so isolating each of them is important. I can use developement db server or local db for this but againly i couldn't find a way to change connection string according to user.

Not now but in near future we are going to run these tests with TFS 2012 builds.

Was it helpful?

Solution

You should try Effort

http://effort.codeplex.com/

It provides an in-memory database for Entity Framework by giving a special connection when creating your DbContext.

It also can populate the database with data from CSV files.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top