-1

Currently, we have time to update the architecture in our test automation framework, and we are searching for the best solution to our needs.

We have this module architecture:

  1. tests-core

    core-api

    core-web

  2. tests-products

    tests-product1-api

    tests-product1-web

    tests-product2-api

    tests-product2-web

We have common functionality for all products: classes, pages, and step definitions in core. 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 test-product module has tests only for this one product.

We use the DI framework, Guice, for binding the appropriate class for the product.

And the problem is that we can bind functionality only for one product at once. If we want to have cross products tests in new tests-products:tests-crossproducts-api/web, then we must rebind all classes each time when we change products during one test.

When this framework was created, there was no need to run such tests, which is why we want to change it.

And now, we want to create and hold objects for two products at once in our cross products test. DI frameworks don't allow it.

Maybe someone has similar problems; how do you resolve them?

Maybe someone knows some design patterns which allow us to do such things? Currently considering such patterns as Decorator and Strategy, but as I see it, Strategy allows us to use one behavior at the same time. Decorator is something that might suit us, but I didn't find an excellent example of how we can do it.

Maybe we can create two contexts and use them use at the right time, and there is some framework for this?

Maybe there is another way we can achieve our needs?

4
  • Are you asking for unit test framework?
    – PDHide
    Apr 25, 2021 at 11:16
  • I am asking about some solution that can give me the ability to have something like two bindings at the same time or to have two contexts for two products at the same time
    – cheparsky
    Apr 25, 2021 at 11:22
  • what you want to test UI ? API? or units?
    – PDHide
    Apr 25, 2021 at 11:25
  • As I wrote above, we have modules for api and web
    – cheparsky
    Apr 25, 2021 at 11:32

1 Answer 1

1

If we want to manipulate two products in one framework and still use Guice we can use @Provide methods. Examples are here and here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.