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:
-
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. -
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.
Record a UI interaction
-
Follow steps 1-6 in Inspect Your App in Appium Inspector.
Start recording -
Click the Start Recording icon to start the UI interactions with your app.
Record a UI interaction -
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
-
In VS Code, open the command palette.
Mac: Shift + Command ⌘ + P
Linux: Shift + Ctrl + P
Command palette -
Enter Kepler: Generate test scenario template.
Create a filename -
Create a filename for test scenario script.
After you generate the template, VS Code displays a message.
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)
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).

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:

-
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.
-
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.
-
[[{"inputKeyEvent": "108", "holdDuration": 0}]]
Example:

-
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.
-
Go back to Appium Inspector.
-
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.

In this section, you:
- Create a test scenario to stream video from the Vega Video App.
- Measure video playback fluidity and time-to-first-frame video fluidity (TTFVF).
- Use Appium Inspector to intereact with the Vega Video App and record your interactions.
- Copy the recorded interactions into your test scenario template from Generate a test scenario script.
To simulate playing video from the Vega Video App

-
In the Appium Inspector, click the Tap/Swipe by Coordinate ([+]) icon.
The cursor changes to a crosshair.
-
Click the UI element of your app where you want to start the UI interaction.
Start UI interaction Tip: Your app is displayed on the left panel of the screen. - Locate the thumbnail for the test video you want to stream.
- Tap the test video thumbnail to open the video player screen.
- Yap the play button to start streaming the video.
- Go back to Appium Inspector.
- 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.
prep
member function so that KPI measurements begin with an active video playback in the 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
-
Open the command palette in VS Code.
Mac: Shift + Command ⌘ + P
Linux: Shift + Ctrl + P
-
Enter Vega: Launch App KPI Visualizer.
Selection of use cases -
Select a use case from the command palette.
Record CPU Profiler -
Make sure the checkbox for the Record CPU Profiler is empty, then press OK.
Custom test scenario dialog box -
Select Yes in the Custom Test Scenario dialog box.
Test scenario script file -
Pass the test scenario you generated in Generate a test scenario script.
-
Run the test.
See sample results in Measure App KPIs.
Related topics
- App Performance Best Practices
- Measure App KPIs
- Identify UI Rendering Issues
- Detect Overdraw
- Investigate Component Re-rendering Issues
Last updated: Sep 30, 2025