|
| 1 | +# Test plan for different (re)initialization scenarios |
| 2 | + |
| 3 | +This is a test plan enlisting possible initialization scenarios. As CSMs |
| 4 | +find bugs arising from unforeseen initialization scenarios, this list should |
| 5 | +be updated. Unless noted, initialization is expected to work in all scenarios. |
| 6 | + |
| 7 | + |
| 8 | +## Assumptions: |
| 9 | +* User followed [Android documentation](https://docs.branch.io/apps/android/) |
| 10 | +* Application can have multiple activities (launcher activity is called |
| 11 | +`SplashActivity` and all others are `NextActivity`) |
| 12 | +* Latest Branch SDK version is being used |
| 13 | + |
| 14 | + |
| 15 | +## Scenario #1: |
| 16 | +* `initSession` is only called in `SplashActivity.onStart`. |
| 17 | + |
| 18 | + |
| 19 | +### 1. Application in background |
| 20 | +``` |
| 21 | +Test by opening the app via: |
| 22 | +* launcher icon |
| 23 | +* recent apps tray (not available in cold start) |
| 24 | +* push notification |
| 25 | +``` |
| 26 | +#### Cold start: |
| 27 | +* Repro: Close app and remove it from the recent apps list |
| 28 | +(not 100% guarantee that this will work because manufacturers determine |
| 29 | +if application is killed when removed from recents list). Alternatively, |
| 30 | +call `adb shell pm clear my.app.package.id` from the command line (this |
| 31 | +will also clear cache and stored data). Open app. |
| 32 | +* Initialization entry point = `SplashActivity.onCreate` |
| 33 | + |
| 34 | + |
| 35 | +#### Warm start: |
| 36 | +* Repro: Close app via the back button. Open app. |
| 37 | +* Initialization entry point = `SplashActivity.onCreate` |
| 38 | + |
| 39 | +#### Hot start: |
| 40 | +* Repro: Close app via the home button. Open app. |
| 41 | +* Initialization entry point is either `SplashActivity.onStart` or |
| 42 | +`BranchActivityLifecycleObserver.onResume` depending on whether `SplashActivity` |
| 43 | +or `NextActivity` was in foreground last. However, if app is opened via |
| 44 | +a push notification, the Initialization entry point is guaranteed to be |
| 45 | +`SplashActivity.onStart`. |
| 46 | + |
| 47 | + |
| 48 | +### 2. Application in foreground |
| 49 | +``` |
| 50 | +Test by opening the app via: |
| 51 | +* push notification |
| 52 | +``` |
| 53 | +#### Burning hot start: |
| 54 | +* Repro: have the app open |
| 55 | +* Initialization entry point = either `SplashActivity.onNewIntent` |
| 56 | +or `SplashActivity.onStart` depending if user is currently on `SplashActivity` |
| 57 | +or `NextActivity` respectively. There is one exception, if the user is on |
| 58 | +`NextActivity` but `SplashActivity` is still partially visible, then the |
| 59 | +entry point will be `SplashActivity.onNewIntent`. |
| 60 | + |
| 61 | +There are four possible scenarios the users can find themselves in, |
| 62 | +`reInitSession` is either called or not and the user is currently in |
| 63 | +`SplashActivity` or in `NextActivity`. Note that documentation gives |
| 64 | +instructions to use `reInitSession`, however it's a new instruction, so |
| 65 | +it may be overlooked by existing users. When the latter happens, we may |
| 66 | +expect an initialization failure: |
| 67 | +* `reInitSession` is not used (i.e. not following documentation) |
| 68 | + * User is in `SplashActivity` = Branch initialization is guaranteed to FAIL |
| 69 | + * User is in `NextActivity` = Branch initialization is expected work _unless_ |
| 70 | + `SplashActivity` is still partially visible (e.g. `NextActivity` is |
| 71 | + semi-transparent or is not using the full screen) |
| 72 | + |
| 73 | + |
| 74 | +## Scenario #2: |
| 75 | +* `initSession` is called in both `SplashActivity` and `NextActivity` |
| 76 | + |
| 77 | +### 1. Application in foreground |
| 78 | +``` |
| 79 | +Test by opening the app via push notification launching `NextActivity`: |
| 80 | +* when `NextActivity` is currently in foreground |
| 81 | +* when `NextActivity` is in backstack (e.g. has been launched before |
| 82 | +but user is currently on another `NextActivity`) |
| 83 | +* when `NextActivity` is NOT in backstack (e.g. this particular |
| 84 | +`NextActivity` has NOT been launched before) |
| 85 | +``` |
| 86 | + |
| 87 | +#### Burning hot start: |
| 88 | +* Repro: have the app open |
| 89 | + |
| 90 | +Again, there are expected failures when `reInitSession` is NOT used in `NextActivity` |
| 91 | +* user is currently in `NextActivity` = guaranteed initialization failure |
| 92 | +* `NextActivity` is in backstack BUT partially visible |
0 commit comments