Activity start process

  • Application OnCreate

    • Load third-party sdk
  • Activity OnCreate

    • Load its own logic
    • Send remote data request
    • Rendering interface

APP startup performance indicators

  1. Cold start: the most important start indicator, focusing on optimization, the recommended time is 5 seconds
  2. Warm start: recommended time 2 seconds
  3. Hot start: recommended time 1.5 seconds
  4. First screen launch

The main process of the test

  1. adb logcat: not accurate enough
  2. Screen recording + video deframing: more accurate, requiring manual operation
  3. Automated tools such as uiautomator for 200ms inspection interface change
  4. traceview
  5. Hard burying point: the most accurate, and the coverage is wider

adb logcat

  • Clean up cached data: adb shell pm clear package
  • Stop the process: adb shell am force-stop package
  • Start the APP: adb shell am start -S -W package/activity
  • Get data: adb logcat | grep -i displayed

Get the result through adb logcat:

  • startTime: Record the time when startActivityAndWait() was just about to be called
  • endTime: record the time point when the startActivityAndWait() function call returns
  • waitTime: startActivityAndWait() call takes time; waitTime = endTime-startTime

Use ffmpeg to deframe

  1. Clear application cache: adb shell am force-stop package
  2. to the designated address of the phone: 16136e3cb1e540 adb shell screenrecord --bugreport --time-limit 30 Screen recording file path &
  3. Start the APP and jump to the specified interface: adb shell am start -S -W package/activity
  4. Pull the screen recording file from the mobile phone to the computer: adb pull The storage path of the screen recording file path
  5. Convert video to gif format: ffmpeg -i screen recording file split format
  6. Split the video into 10 frames per second and store it as a jpg format picture: ffmpeg -i screen recording file -r 10 frames_%03d.jpg
  7. Then analyze the picture frame by frame to find the click time and the time to open the specified interface, so as to calculate the startup time

机智的测试生活
88 声望478 粉丝

公号|机智的测试生活