Question or problem
I have been considering using Tuist was a way to improve feedback on PRS.
Ideally I’d like to make use of the selective testing feature, which I understand will run tests when either the hash of the tests in a module change, or if the hash of tests of a module that my module depends on changes.
described here: xcodebuild · Selective testing · Develop · Guides · Tuist
This makes sense, but when this is used with a project that uses Modular architecture and dependency inversion, then modules (deliberately) do not depend directly on other modules. The dependencies are abstracted through a ‘contract’ interface. In this case I don’t see how the default logic in selective testing can ensure the correct tests are run when the project changes.
Modular architecture and dependency inversion described: Dependency Inversion as a Driver to Scale Mobile Development | SoundCloud Backstage Blog
Using the example from Soundcloud blog linked in
I have 3 modules:
Payment - Needs to use Authentication, depends on AuthenticatingContract as an abstraction
AuthenticatingContract - Defines the protocol used by Payment
Authentication - Implements AuthenticatingContract
If the implementation of AuthenticatingContract changes (eg in the Authentication module), I would like the Payment UI Tests to be run. However, Payment depends on AuthenticatingContract, and this hasn’t changed, so the selective testing process from Tuist would not help me.
Please can you let me know how it can be possible to achieve this, eg is there a way to write my own selective testing rules? Can I detect if a module implements a contract, and then test all consumers of that contract when the implementation changes?
Expectation
It would be great if there was a supported way to achieve selective testing when the project architecture uses The Modular Architecture and dependency inversion between modules as described in your documentation.