public class IntentsTestRule<T extends Activity> extends ActivityTestRule<T>


This rule makes it easy to use Espresso-Intents APIs in functional UI tests. This class is an extension of ActivityTestRule, which initializes Espresso-Intents before each test annotated with org.junit.Test and releases Espresso-Intents after each test run. The Activity will be terminated after each test and this rule can be used in the same way as ActivityTestRule.

Espresso-Intents APIs can be used in two ways:

  • Intent Verification, using the intended API
  • Intent Stubbing, using the intending API
Parameters
<T extends Activity>

The activity to test

Summary

Public constructors

IntentsTestRule(Class<T> activityClass)

This method is deprecated. Deprecated in Java

IntentsTestRule(Class<T> activityClass, boolean initialTouchMode)

This method is deprecated. Deprecated in Java

IntentsTestRule(
    Class<T> activityClass,
    boolean initialTouchMode,
    boolean launchActivity
)

This method is deprecated. Deprecated in Java

Protected methods

void

This method is deprecated. Deprecated in Java

void

This method is deprecated. Deprecated in Java

Inherited fields

From androidx.test.rule.ActivityTestRule
volatile Instrumentation.ActivityResult

This field is deprecated. Deprecated in Java

Inherited methods

From androidx.test.rule.ActivityTestRule
Statement
apply(Statement base, Description description)

This method is deprecated. Deprecated in Java

void

This method is deprecated. Deprecated in Java

void

This method is deprecated. Deprecated in Java

T

This method is deprecated. Deprecated in Java

Intent

This method is deprecated. Deprecated in Java

Instrumentation.ActivityResult

This method is deprecated. Deprecated in Java

T

This method is deprecated. Deprecated in Java

void

This method is deprecated. Deprecated in Java

From org.junit.rules.TestRule
abstract Statement

This method is deprecated. Deprecated in Java

Public constructors

IntentsTestRule

public IntentsTestRule(Class<T> activityClass)

IntentsTestRule

public IntentsTestRule(Class<T> activityClass, boolean initialTouchMode)

IntentsTestRule

public IntentsTestRule(
    Class<T> activityClass,
    boolean initialTouchMode,
    boolean launchActivity
)

Protected methods

afterActivityFinished

protected void afterActivityFinished()

Override this method to execute any code that should run after the currently launched Activity is finished. This method is called after each test method, including any method annotated with org.junit.After.

Prefer org.junit.After over this method. This method should usually not be overwritten directly in tests and only be used by subclasses of ActivityTestRule to get notified when the activity is created and visible but test runs.

afterActivityLaunched

protected void afterActivityLaunched()

Override this method to execute any code that should run after your Activity is launched, but before any test code is run including any method annotated with org.junit.Before.

Prefer org.junit.Before over this method. This method should usually not be overwritten directly in tests and only be used by subclasses of ActivityTestRule to get notified when the activity is created and visible but test runs.