Integration tests in Continuous Integration environment: Database and filesystem state

Posted by dario_ramos on Stack Overflow See other posts from Stack Overflow or by dario_ramos
Published on 2012-04-12T17:25:54Z Indexed on 2012/04/12 17:28 UTC
Read the original article Hit count: 458

I'm trying to implement automated integration tests for my application. It's a very complex monster. You could say that its database and part of the filesystem are part of its state, because it saves image files in the hard drive, and references to those in the DB. The software needs all those, in a coherent state, to work properly.

Back to writing tests: To run any relevant test, I need some image files in the filesystem, and certain records filled in the database. I thought of putting all of these in a separate folder called TestEnvironmentData in the repository, and retrieving them from the Continuous Integration Server (Team City), but a colleague said the repo is quite full as it is, and that I should set up a special directory, and databases, only in the Continuous Integration server. I don't like that because the tests success depend on me manually mantaining stuff in the server, and restoring initial state before every test becomes cumbersome.

What do you guys do when you need to write integration tests for an app like this? The main goal is having an automated test harness to approach a large scale refactoring. There's lots of spaghetti code and the app's current architecture is hardly unit testable, that's why I decided on integration tests first.

Any alternative approach is welcome.

© Stack Overflow or respective owner

Related posts about database

Related posts about filesystems