as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support

Measure Fluidity and Foreground Memory

The App KPI Visualizer tool helps you monitor and optimize key app performance metrics: Foreground memory, and UI and video fluidity.

Foreground memory

Measures your app's resident set size (RSS) when active, including shared and private RAM memory. Monitor foreground memory to detect memory consumption during:

  • App launch
  • Transitions between foreground and background
  • Memory-intensive operations

UI and video fluidity

Tracks smooth performance of:

  • UI interactions
  • Video playback quality

Low fluidity can result in UI lag and video frame drops, reducing user satisfaction.

To evaluate your app's performance, the process involves:

By following this process, you can detect and resolve fluidity problems and high foreground memory consumption before they impact your users.

Prerequisites

Before you measure the UI and video streaming fluidity of your app, complete the following:

  1. Download, build, and install the Vega video app.

    Follow the instructions in Vega Video app documentation (available soon on GitHub).

    After you download the app, check the samples directory for sample test scenarios. Follow the guidance according to your app specific requirements.

  2. Install Appium Server and Appium Vega Driver.

    Follow steps 1-4 in Install Appium for Vega integration.

    You need Appium, an automation tool, to write scripts and measure the fluidity of your app.

  3. Download Appium Inspector.

Record a UI interaction

  1. Follow steps 1-6 in Inspect Your App in Appium Inspector.

    The image shows where to click Start Recording
    Start recording
  2. Click the Start Recording icon to start the UI interactions with your app.

    The image shows where to click Tap/Swipe by Coordinates
    Record a UI interaction
  3. Click the Tap/Swipe by Coordinate ([+]) icon on the left panel of the screen.

Generate a test scenario script

To measure KPIs accurately, create a test scenario that defines expected UI interactions for:

  • Foreground memory monitoring
  • UI fluidity assessment
  • Video fluidity evaluation

The test scenario ensures KPI measurements reflect real user interaction patterns.

To generate a test scenario script

  1. In VS Code, open the command palette.

    Mac: Shift + Command ⌘ + P

    Linux: Shift + Ctrl + P

    The image shows the command palette where you enter Vega: Generate test scenario template
    Command palette
  2. Enter Kepler: Generate test scenario template.

    The image shows where to create a filename for your test scenario
    Create a filename
  3. Create a filename for test scenario script.

    After you generate the template, VS Code displays a message.

    VS Code displays a message after successful template generation
    Message for successful template generation

    Python is the language for this template. Inside the template, you can the find TestRunner class, which contains two members:

    • prep (in blue box)
    • run (in red box)
    The image shows two members in the TestRunner class
    TestRunner

    During the test, each member performs a function:

    • prep - Performs all necessary preparations before running the actual test scenario.

      For example, if you want to play video, the code to navigate to the video carousel in your app and playing the video should be defined inside this member function. An example of the prep is in Create a test scenario.

    • run - Defines the UI interactions and actions for your test case.

      For example, if you want to play video and measure video playback fluidity for a certain period of time, call the sleep function to wait for that duration.

Create a test scenario

Each tab presents a test scenario that simulates UI interactions and video streaming within your app.


The Amazon Fire TV Stick includes a remote control with a black circular directional pad (D-pad).

The image shows black circular directional pad (D-pad)on Amazon Fire TV Stick
Amazon Fire TV Stick

In this section, you create a test scenario to switch the UI component in your app by simulating the D-pad input. You write code that replicates a remote control's D-pad functionality. By pressing the D-pad, your app users can cycle through options or move a selection in a specific direction they choose. Your code should enable the same navigation experience within your app's UI.

To simulate D-pad input, follow these steps:

The gif image shows the process of creating a test scenario
Process of creating a test scenario
  1. In Appium Inspector, go to the Commands tab and select Execute Script > executeScript.

    This action sends the UI interaction command from Appium Inspector to the Vega device.

  2. To simulate pressing the D-pad keys on a remote control, use the executeScript method with the following arguments:

  • executeScriptCommand - Use jsonrpc: injectInputKeyEvent to send key events representing D-pad key presses.

  • jsonArgument - A JSON object with the following properties:

    • inputKeyEvent (string) - The key event value for the D-pad direction. To find the codes for D-pad, see the D-pad navigation section in Appium commands.

    • holdDuration (number) - The duration in milliseconds to simulate holding the D-pad key pressed. Use 0 for a single press.

    For example, copy the following code and add it to jsonArgument to send a D-pad "Down" command with 0 seconds hold duration.

Copied to clipboard.

[[{"inputKeyEvent": "108", "holdDuration": 0}]]

Example:

The image show the Appium Inspector user interface where you add the script for jsonAgrument
jsonArgument script
  1. Generate a test scenario template and copy the UI interactions recorded from the Appium Inspector to the template.

    Follow the steps in Generate a test scenario script.

  1. Go back to Appium Inspector.

  2. Click the Recorder tab to see the recorded code.

In this test scenario, the goal is to:

  • Launch an app in ready-state without UI interactions.

  • Measure the UI fluidity of an app while sending a D-pad key to move the UI focus on the page.

You don't need to define anything in the prep member function when copying code from the Appium Inspector's Recorder box. The Recorder captures your interactions with the app's UI during the recording session. Paste the code representing the recorded UI interactions into the run member function. The code executes the same UI interactions on the app during test execution.

In the following image, the test simulates repeated user input by sending the same D-pad key press event five times in a loop.

The image shows a test simulates repeated user input by sending the same D-pad key press event five times in a loop
D-pad key press events

In this section, you:

  1. Create a test scenario to stream video from the Vega Video App.
  2. Measure video playback fluidity and time-to-first-frame video fluidity (TTFVF).
  3. Use Appium Inspector to intereact with the Vega Video App and record your interactions.
  4. Copy the recorded interactions into your test scenario template from Generate a test scenario script.

To simulate playing video from the Vega Video App

The gif image shows the process of creating a test scenario
Process of creating a test scenario
  1. In the Appium Inspector, click the Tap/Swipe by Coordinate ([+]) icon.

    The cursor changes to a crosshair.

  2. Click the UI element of your app where you want to start the UI interaction.

    The gif image shows the process of simulating playing video
    Start UI interaction
  3. Locate the thumbnail for the test video you want to stream.
  4. Tap the test video thumbnail to open the video player screen.
  5. Yap the play button to start streaming the video.
  6. Go back to Appium Inspector.
  7. Click the Recorder tab to see recorded code.

In this test scenario, the goal is to:

  • Launch the Vega video app.
  • Start the video playback by clicking the video thumbnail and the play button. The app enters a ready-state mode to measure video playback fluidity.
  • Measure the video playback fluidity for the duration that you want.

Define two key functions in your app:

  • prep is an acronym to preparation. Therefore, it should contain actions to setup the test for an iteration.
  • run member function should contain actions related to actual KPI measurements for a test iteration.
The image shows two key functions in your app
prep and run member function

In the image:

  • The prep (in blue box) member function code navigates to the Vega Video App carousel and starts the video.
  • The run (in red box) member function measures video streaming fluidity.

Measure the fluidity of your app

  1. Open the command palette in VS Code.

    Mac: Shift + Command ⌘ + P

    Linux: Shift + Ctrl + P

  2. Enter Vega: Launch App KPI Visualizer.

    The image shows the command palette where you can select the use case to run the KPI Visualizer with
    Selection of use cases
  3. Select a use case from the command palette.

    The image shows the checkbox for the Record CPU Profiler is empty
    Record CPU Profiler
  4. Make sure the checkbox for the Record CPU Profiler is empty, then press OK.

    The dialog box prompts you to select Yes or No
    Custom test scenario dialog box
  5. Select Yes in the Custom Test Scenario dialog box.

    The image shows how to pass the test scenario script
    Test scenario script file
  6. Pass the test scenario you generated in Generate a test scenario script.

  7. Run the test.

See sample results in Measure App KPIs.


Last updated: Sep 30, 2025