Skip to content

Provide a listener or hook in ActivityTestRule to run something after a test is run and before an activity is finished  #32

@chemouna

Description

@chemouna

I'm trying to write a TestRule that takes a screenshot after a test is run , the code for taking screenshot is working, I'm extending ActivityTestRule but i don't have any hook to run my takeScreenshot method after a test is done but before an activity is finished.

//in ActivityStatement 
      @Override
        public void evaluate() throws Throwable {
            try {
                if (mLaunchActivity) {
                    mActivity = launchActivity(getActivityIntent());
                }
                mBase.evaluate();
            } finally {
                // I need to take a screenshot here , maybe something like beforeActivityFinished 
                finishActivity();
                afterActivityFinished();
            }
        }

maybe ActivityTestRule could have a beforeActivityFinished listener that is invoked just before finishActivity ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions