Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Cache LLM Results by XPath and Expect Keys to Minimize API Costs on Unchanged UI Screens #291

@Masaki-U

Description

@Masaki-U

Hi, thank you for the great project and all your hard work! 🙏

Background

  • current Arbigent workflow, every test step invokes the LLM to decide the “next action,” even if the UI state has no change.

  • Re-running identical regression tests on Web, iOS, or Android screens that haven’t been modified causes unnecessary cost.

Problem Statement

  • When a screen’s HTML (Web) or UI Automator hierarchy (Android/iOS) and its corresponding “expect” assertion remain exactly the same, repeating the same LLM query wastes tokens without adding any new value.
  • We need a lightweight, file-based caching mechanism that detects when “nothing has changed” and reuses the previous LLM response instead of calling the LLM API.

Solution

  • Key Generation: Screen DOM Hash + Screen Shot Hash + Expect Text
    • For each test step, capture a snapshot of the displayed UI:
      • Web: Serialize the relevant portion of the DOM as a string (e.g. element.outerHTML, full page HTML, or a trimmed subset).
      • iOS / Android: Serialize the UI Automator tree or accessibility node hierarchy for the current screen.
    • Use this key as the filename to save the LLM response into a JSON file, and retrieve it with getOrPut.

Files Found in Your Project

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions