-
Notifications
You must be signed in to change notification settings - Fork 0
What is ActivityTestRule
Devrath edited this page Jul 3, 2021
·
2 revisions
- This rule is used to launch an activity in instrumentation testing.
- Basically this test rule provides functional testing of a single activity.
androidTestImplementation ‘com.android.support.test:rules:1.0.2’
// Global declaration
@Rule
public ActivityTestRule<SampleActivity> activityRule = new ActivityTestRule<>(SampleActivity.class, true, false);
// In Each test or in the @before block
Intent i = new Intent(activityRule.getActivity(), SampleActivity.class);
activityRule.launchActivity(i);