Factory Time

Posted by Aaron Probus

Factory Time is an open source Clojure library for managing test data.

Intro

When we started building the new investor API we went down the road of keeping things as simple as possible.
In order to keep each test as a self contained unit test data was declared at the top of each file.
As the project grew larger, this resulted in duplicated test data, and worse, bugs.

At this point it was time to extract the data out of the individual test files.

The first pass consisted of moving the test data definitions into a separate namespace and removing duplicates.
Next, we created a consistent access point to the data by leveraging a multi-method that also handled overriding of values.
The result was:

Once the initial pass was completed, it was clear that the data managing functions could exist as a standalone library.
From there, we extracted Factory Time into a separate library and added some extra features.