I wrote a UI test scenario by Cucumber and Espresso for a modular Android project. This project has a module that depends on the Base module. When I run the test I got an error in the xml layout, because this module apparently doesn't have access to the Base module's resources (when test run only) for example, include a layout from the Base module or a custom view.
.Feature Enter receiver details > Scenario Outline "Register Person" FAILED android.view.InflateException: Binary XML file line #9 in [package_name].test:layout/fragment_register_person: Binary XML file line #2 in [package_name].test:layout/toolbar_title: Error inflating class com.google.android.material.appbar.AppBarLayout Caused by: android.view.InflateException: Binary XML file line #2 in [package_name].test:layout/toolbar_title: Error inflating class com.google.android.material.appbar.AppBarLayout In this case I used :
<include layout="@layout/toolbar_title" /> and a custom view :
<com.me.base.view.customview.RtlTextInputLayout that are imported from the Base module. and I also added :
androidTestImplementation project(path: ':Base') in current module.
I ran my test by executing a Gradle command in Android Studio Terminal :
gradlew myModule:connectedCheck -Pcucumber -Pscenario="Register Person" What can I do?