Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActivityFinisher should wait until all finishing Activities are completely destroyed before running next test #117

Open
GoogleCodeExporter opened this issue Apr 15, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Have some sort of global RPC mechanism where your app can register listeners.
2. In your test setUp, have this RPC mechanism notify all registered listeners 
(no Activity should be launched yet).
3. Have an Activity that registers a listener during its onCreate() and 
unregisters it during its onDestroy() with this RPC mechanism. The listener can 
simply log to logcat when notified.
4. Have several tests that simply launch the Activity.
5. Run the entire Test class such that all the test methods are run within one 
'adb shell am instrument' execution.

Expected:
You should never see any output from the Activity-scoped listener during 
setUp().

Actual:
Sometimes the Activity from the previous test may be finishing but not yet 
destroyed by the time the next test's setUp() is invoked. As a result, the 
Activity-scoped listener from the previous test remains registered during the 
current test for a small window of time. This is essentially a short-term leak 
into the next test.

What version of the product are you using? On what operating system?
Both Espresso 1.1 with GoogleInstrumentionTestRunner and Espresso 2.0 with 
AndroidJUnitRunner on API 19. More prevalent on an x86 emulator with Hardware 
and GPU acceleration.

Depending on how your app is designed, this can cause test reliability issues 
when running all your tests in one go versus running only one test method per 
'adb shell am instrument' execution.

Original issue reported on code.google.com by [email protected] on 15 Jan 2015 at 8:17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant