Is there any way to launch a particular Activity from Espresso Recorder?
Asked Answered
B

2

10

I am using Espresso for my UI Testing. In Espresso, I can test any particular activity I want without having to go from the first activity with the following rule.

@Rule
public ActivityTestRule activityTestRule = new ActivityTestRule(HomeActivity.class);

Note: Here HomeActivity comes after LoginActivity.

But when I am using Espresso recorder, it always seems to begin the test from LoginActivity.I need to launch HomeActivity directly. So is there any option in Android Studio to launch a particular activity with Espresso Recorder.

Bactericide answered 19/9, 2016 at 12:4 Comment(0)
R
6

I just edit the manifest and set the activity I want to test as the first activity before running the test recorder.

    <activity android:name="ActivityToTest">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

And after recording the test of that activity I just restore the manifest.

Hope it helps.

Retorsion answered 21/9, 2016 at 7:45 Comment(2)
This will not be helpful if I am having a lot of activities.Bactericide
This is Probably a work around and if we can use it somehow. But in a complex structure this wont be usefullPoach
H
1

If your application flow is HomeActivity after Login Activity then you will not be able to launch HomeActvity first

Honniball answered 6/10, 2016 at 12:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.