android-test icon indicating copy to clipboard operation
android-test copied to clipboard

Add LazyActivityScenarioRule that defers the launch of the Activity until needed

Open bohsen opened this issue 3 years ago • 7 comments

Overview

This change makes it possible to defer the launch of the Activity under test until the first call to LazyActivityScenarioRule.getScenario(), so that different setups/options can be initialized before the Activity is launched.

Fixes #446.

Proposed Changes

  • Add LazyActivityScenarioRule (similar to ActivityScenarioRule) that instead of launching the Activity under test right away, defers this until the first call to LazyActivityScenarioRule.getScenario(). This makes it possible to initialize different setups ie. populate an in-memory database, prepare test data, deactivate wifi etc.
  • Add the possibility to disable() the new Rule in tests that doesn't need an Activity to run, ie. tests for:
    • internal utility-methods
    • internal test data generators etc.

bohsen avatar Sep 24 '20 07:09 bohsen

+1

YuraLaguta avatar Feb 15 '21 05:02 YuraLaguta

+1

murilodag avatar Apr 13 '21 16:04 murilodag

+1!!! Please merge this

victormpineda avatar Jul 30 '21 11:07 victormpineda

+1 👌

eduardbosch avatar Jul 30 '21 11:07 eduardbosch

+1

rabacadabra avatar Dec 13 '21 06:12 rabacadabra

👍

m-kubis avatar Feb 01 '22 12:02 m-kubis

+1 👍 @googlebot

Ekt0s avatar Jun 15 '22 14:06 Ekt0s