O Google tem o compromisso de promover a igualdade racial para as comunidades negras. Saiba como.



ActivityTestRule<T extends Activity> This class is deprecated. use ActivityScenario or ActivityScenarioRule instead. They offer a simpler, and safer way of controlling Activity lifecycles.

Here are some tips to consider when converting to ActivityScenario/Rule:

  1. For simple cases where you want to launch the Activity before each test and tear it down after each test (eg you are using ActivityTestRule(Class)), convert directly to ActivityScenarioRule.
  2. If you need control over when to launch the Activity (eg you are using ERROR(/#ActivityTestRule(Class, false, false)), use ActivityScenario.launch. Its recommended to wrap the launch in a try-block, so the Activity is closed automatically. try (ActivityScenario.launch(activityClass)) { ... }
  3. If you need access to the Activity during the test (eg you are calling getActivity() provide a Runnable callback to ERROR(/androidx.test.core.app.ActivityScenario#onActivity(Runnable)) instead. The callback provided to onActivity will run on the application's main thread, thus ensuring a safer mechanism to access the Activity.
DisableOnAndroidDebug The DisableOnAndroidDebug Rule allows you to label certain rules to be disabled when debugging. 
GrantPermissionRule The GrantPermissionRule Rule allows granting of runtime permissions on Android M (API 23) and above. 
ServiceTestRule A JUnit rule that provides a simplified mechanism to start and shutdown your service before and after the duration of your test. 
UiThreadTestRule This class is deprecated. use UiThreadTest directly without this rule. UiThreadTest is now supported as part of the core Android test runner to provide the ability to run methods annotated with @Before and @After on the UI thread regardless of what @Test is annotated with.