freepascal / android-test-kit

Automatically exported from code.google.com/p/android-test-kit
0 stars 0 forks source link

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

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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 mhernan...@gmail.com on 15 Jan 2015 at 8:17

GoogleCodeExporter commented 9 years ago

Original comment by vale...@google.com on 18 Mar 2015 at 5:26