Ideas for testing across multiple projects?

I have seven related projects, one the core library and the others extensions to the core. Essentially, they are libraries that are downstream from the core, depending on it.

Sometimes I want to run all the tests across all the projects. For example, I change something in core and want to see if it messes up any of the extensions.

Does anyone have any rough clues as to how I should approach this?

For example, maybe there is a library that already does this (which I have not been able to find). Or failing that, if I make a new project to accomplish this, any clues as to the core steps? Presumably I’ll need to load the other projects onto the classpath, than execute a test runner on each one (possibly using the Cognitect test runner library?).

Everything is currently using tools.deps so each project has a deps.edn file. I actually already made a new project to serve as the “testing apex”. It depends on the other projects and has its own tests that exercise multiple extensions at once. I tried adapting it to run the tests in the other projects but the obvious things failed; clj/tools.deps will not allow you to add things outside the project dir onto the classpath (“:paths”) or into :aliases / :test / :extra-paths.

You can pass outside dirs to the Cognitect test runner more directly using something like clj -X:test :dirs '["test" "../foo/test"]' but this doesn’t help much as “../foo/src” is not on the classpath.

Anyway I can probably bash something together in due course but if anyone has done this before and has any tips, I’ll be grateful. :pray:

Polylith - Polylith (gitbook.io) sounds a pretty good fit for this, since it has incremental testing and also lets you focus on testing via different “project” focus.

1 Like