The Polylith architecture can support incremental testing if we build tools for it.
The illustrations here are based on the previous Sharing code page. Now let's see how we can test code incrementally in Polylith.
Here are our bricks. If only the red brick is changed…
…we can calculate which services and bricks that are affected, by checking how the bricks depend on each other:
Because the red brick is changed, we know that we need to execute the tests for the red, yellow, and blue bricks, from service A, because they are all directly or indirectly affected by the change. The green and purple bricks are not affected and we can therefore skip testing them.
Tests that are run incrementally run faster as we usually don’t need to run the entire test suite. This applies both when we run tests locally and in the CI build.
An example of a tool that supports incremental testing is the poly tool for Clojure.