android / testing-samples

A collection of samples demonstrating different frameworks and techniques for automated testing
Apache License 2.0
9.21k stars 3.62k forks source link

Request: Add an espresso sample with multiple modules in 1 app #189

Open tdekoning opened 6 years ago

tdekoning commented 6 years ago

If someone wants to add instant app support to their app or just divide their app into separate modules, it would be nice to be able to test those modules using Espresso. I couldn't find any examples that show the use of Espresso with multiple modules in 1 app.

Can someone add this?

mrk-han commented 6 years ago

This would be awesome

vitor-efo commented 5 years ago

Also that example could include Dynamic Feature Modules :) https://developer.android.com/studio/projects/dynamic-delivery#dynamic_feature_modules

vahidlazio commented 5 years ago

I'v migrated to app bundles and made dynamic & instant feature modules but we I couldn't get Espresso working with my dynamic feature module. already thinking to revert to library modules so at least espresso works again.

mrk-han commented 5 years ago

We are using Espresso with Multi-Module. We put all dependencies and tests in the last apk module which depends on all other modules (and contains gradle task which builds the APK). We are not using Dynamic Feature Modules though. @vahidlazio Are you saying that your tests broke when switching to Dynamic Feature modules and were working before that?

vahidlazio commented 5 years ago

Firstly, Moving tests to some other module even like :app or base module kind of violates separation of concern. It means you have a team working on this module but the tests should be in other module. Even we consider this as a good compromise, dynamic_feature is not visible to base module (:app) because it's defined as a feature not a dependency so you technically can't move your tests to the base module since your app module doesn't even depend on the feature module.

vahidlazio commented 5 years ago

Maybe this one is more relevant https://github.com/googlesamples/android-dynamic-features/issues/32