Class DefaultTestLifecycle

  • All Implemented Interfaces:
    TestLifecycle

    public class DefaultTestLifecycle
    extends Object
    implements TestLifecycle
    The default TestLifecycle used by Robolectric.

    Owing to tradeoffs, this class is not guaranteed to work with LazyApplication enabled on tests where the application is inferred from the apk (instead of explicitly specified in AndroidManifest.xml).

    • Constructor Detail

      • DefaultTestLifecycle

        public DefaultTestLifecycle()
    • Method Detail

      • beforeTest

        public void beforeTest​(Method method)
        Called before each test method is run.
        Specified by:
        beforeTest in interface TestLifecycle
        Parameters:
        method - the test method about to be run
      • prepareTest

        public void prepareTest​(Object test)
        Description copied from interface: TestLifecycle
        Called after each test method is run.
        Specified by:
        prepareTest in interface TestLifecycle
        Parameters:
        test - the instance of the test class that is about to be used
      • afterTest

        public void afterTest​(Method method)
        Called after each test method is run.
        Specified by:
        afterTest in interface TestLifecycle
        Parameters:
        method - the test method that just ran.