Currently we have time for updating architecture in our test automation framework and we searching for the best solution to our needs.
We have this module architecture:
In core we have common functionality for all products: classes, pages, stepdefs. Yes, they are very similar.
In tests-products modules we have overridden implementations for the relevant products also unique functionality for this product.
Web modules are dependent on api modules.
Each tests-products module has tests only for this one product.
We use DI framework Guice for binding the appropriate class for product.
And the problem is that we can bind functionality only for one product at once. If we want to have crossproducts tests in new tests-products:tests-crossproducts-api/web then we must rebind all classes each time when we change product during one tests.
When this framework was created, there was no need to run such tests and this is reason why we want to change it.
And now we want to create and hold objects for two products at once in our crossproducts test. DI frameworks don't allow it.
Maybe someone has similar problems, how you resolve it?
Maybe someone know some design patterns which allow us to do such things? Currently considering such patterns as Decorator and Strategy, but as I see Strategy allow as to use one behavior at the same time. Decorator is something that might suit us but I didn't find a good example how we can do it.
Maybe we can create two context and use them use at the right time and there are some framework for this?
Maybe there is another way we can achieve our needs?
Thanks in advance for the proposed architecture, best practices, patterns, frameworks, etc.