I have three actions in my application
- Login Activity
- Primary activity
- Detailed description
I want to use espresso to check the sequence of events: press the login button to enter the system that will open the main action, and then click the list item in the main action that will open the detailed activity, and then click another button in the details. I started by creating this simple test to get a link to a list:
public class LoginActivityTest extends ActivityInstrumentationTestCase2<LoginActivity> { public LoginActivityTest() { super(LoginActivity.class); } @Override public void setUp() throws Exception { super.setUp(); getActivity(); } public void testSequence() throws Exception {
In the mainActivity onCreate() method, I load the following snippet:
getFragmentManager().beginTransaction() .add(R.id.container, mListFragment) .commit();
The ListFragment flag has a list ( R.id.list ), but still the test failed with a NoMatchingViewException :
android.support.test.espresso.NoMatchingViewException: No views in hierarchy found matching: with id: com.tests.android.development:id/list
What am I doing wrong?
source share