I’ve been playing around with Stuart Halloway’s transcriptor library for writing example-based tests, primarily because its simplicity was really appealing and its use of spec, but I’m hitting some blockers particularly when attempting to do integration testing.
To be a little be more specific I’m developing a library that will allow users to use their preferred SQL vendor (e.g. postgres or mysql), which of course means there exists vendor specific SQL in a few places. This of course means that my integration tests should be applied against all SQL vendors my library supports and this is really the crux of the problem.
I eventually want to be able to run these tests through a build pipeline by potentially setting up some kind of alias in a deps.edn file, the problem lies in conveying which database vendor context I want to run my transcriptor scripts under.
My initial approach was to set up a main function that acts as the test-runner which accepts some command line args, one of which would be the name of the database vendor, using this data I could then decide which database to spin up and perhaps bind that connection to a dynamic var that my tests could make use of, and then potentially clean up that connection inside the exit-on function. I would then invoke that main function for each vendor I wanted to test.
However I’m beginning to wonder if transcriptor is perhaps too lightweight, and maybe something like greenlight would be better, at the cost of simplicity, the extra legwork I’m having to do makes me think so. Has anyone had any experience using transcriptor for these sorts of tests? (or integration tests in general).
Any advice would be much appreciated!