I cannot understand why not using "@+id/loginMainLayout" and "@+id/signUpMainLayout" when the name is in lowerCamelCase , which is common in kotlin and java. the use case will be signUpMainLayout.doSomething() , as you said.
In any case, it is good practice to use unique names for id in the whole application. this is not due to Espresso, but mainly to find out where the view is associated with the identifier when you see the ID name. it is not difficult if you use this style. Example:
in fragment_contacts :
<TextView id="+id/contactNameText android:text="John Smith" .../> <ImageView id="+id/contactUserImage .../>
assert: there is an Image in contactUserImage , because it is ImageView.
in fragment_settings :
<TextView id="+id/settingsNotificationText android:text="Turn notifications on/off" .../> <checkBox id="+id/settingsNotificationCheck .../>
David source share