Stoycho Andreev
2 min readOct 4, 2019

--

Hi Igor,

Good article I would say, but I think it is not completed, because you are talking only about feature modules. We should also consider the need of shared modules, like for example API module, maybe Utils module, maybe Base module, maybe Base UI components module etc.

If you don’t have these modules separately from your feature modules, you will suffer a lot, because you will have duplications all across the feature modules and the support about that it is gonna be difficult.

I think your unit tests are gonna be fine, and you shall put them in the corresponding feature module, because they are tests about your units, your features.

When we are talking about UI tests, integration tests, user story tests, regression tests etc., everything which includes the usage of Espresso testing framework, then we need to consider some differences:

  • If the Espresso test is just about single screen, then obviously you can place it again in the corresponding feature module;
  • If the Espresso test is about combining multiple screen from multiple modules, then obviously you can’t place that kind of test in some of the feature modules, because they shouldn’t know about each other. In this case you better place this test in the app module, because that is the only place where every dependency is available.
  • Also maybe it is possible to place all kind of UI test in the app module, due to the same reason with the dependencies and keep all UI tests, integration tests, user story tests, regression tests etc. in one place, where everything is possible and available. You can separate the test with custom annotations and run them separately only if you need them.

BTW: If I didn’t need to work only on legacy projects, which are almost impossible to refactor, I would keep my app module clean of any source code (without src folder) and I will keep there only the Espresso tests, all of them(UI tests, Regression tests, Acceptance tests etc.). If you ask your self , how is that possible, I would recommend you to read the principles of the Android Instant apps and how to create modular instant applications in Android.

I hope this information is gonna supplement a little bit your theory about the right way of structuring clean architecture in multi module Android project.

Thanks

--

--