image/svg+xml

Refactored Intergration Tests in Fluent Migrator

Improved test coverage and maintainablity for subset of integration tests.

Motivation

A subset of the existing integration tests in the project shared a common set of test cases, though not every supported database had the same test coverage. My hope was to cleanup and refactor the code in order to help the community add new tests and keep a high level test coverage as new SQL databases or functionality is supported.

Background

As I looked into the test coverage of the project, I came across a subset of the tests which had “patchy” test coverage across the different database implementations. These tests seemed to be a good candidate for the introduction of test “abstract” classes. For this work I had chosen to limit the scope to cover the following databases:

The reason Jet, MySql and SQLite tests were not included in the scope was that they had so few integration tests associated with them that it was not worth the effort.

Implementation

The approach I took was:

  1. Create test “abstract” classes to cover the most common share tests across databases.
  2. Move processor tests into individual folders.
  3. Refactor existing test code.
  4. Add extra tests where necessary.

Evaluation

Pull Request Avaliable on Github

The pull request for this work is avaliable, see Pull Request 406: Refactor Processor Integration Tests

About Project - Fluent Migrator

The fluentmigrator project is owned by Sean Chambers and it enables database migration scripts to be written in C# without requiring schema or data changes to use SQL strings.

Find out more at: https://github.com/schambers/fluentmigrator/