Version Control – Should Test Files Be Stored in Source Control?

filestestingversion control

I have a number of (large) test files that need to be maintained. This means access to their history is a requirement.

Benefits

  • Any new developers get the entire test suite with just a git pull.
  • The history of the files is backed up.
  • The files themselves are backed up.

Drawbacks

  • Huge increase in size of repository.
  • Huge increase in download size of new developers copying the repository.

What are the best practices for maintaining test files?

Do I store these files in source control? Are there any alternatives?

Best Answer

Store them in source control. The benefits you listed are all very good ones. When you say that doing this will result in a "huge" size, just how huge are you talking? 100's of gigabytes? Terabytes?

If storage is really that much of a problem, could you zip the files, store the zip file in source control and then have a script that unzips them when the test cases are run? You'd lose detailed history of each file that way (unless you can find a tool that will unzip and show history in memory), but new developers would still have easy access to test files.

Depending on the nature of your test data, you could have a script to generate test files. This might work if you are testing very large images that can be generated procedurally (SQL inserts to populate a database can also be easily generated by a program or script), but this technique does not apply to all kinds of test data...

Related Topic