← ClaudeAtlas

testdrivercachelisted

Speed up tests with screenshot-based caching
testdriverai/testdriverai · ★ 243 · Testing & QA · score 72
Install: claude install-skill testdriverai/testdriverai
<!-- Generated from cache.mdx. DO NOT EDIT. --> ## Overview The cache system makes repeated test runs faster. It compares screenshots to cached results. When the screen did not change much, TestDriver uses the cached element positions again. It does not make an AI call. The cache works at two levels: - **Screen cache**: a pixel diff comparison between the present screenshot and the cached screenshot - **Element cache**: OpenCV template matching to make sure that the cached element position is still correct ## How It Works 1. On `find()`, the SDK sends the present screenshot and the cache metadata to the API. 2. The API compares the screenshot against the cached results for the same `cacheKey`. 3. If the screen pixel diff is in the `screen` threshold AND the element template match is more than the `element` threshold, TestDriver returns the cached position. 4. If not, TestDriver makes a new AI call and caches the result. ```mermaid flowchart LR A[Screenshot + cacheKey] --> B{Screen Diff\n< threshold?} B -- Yes --> C{Template\nMatch OK?} C -- Yes --> D[Return cached position] B -- No --> E[AI Call - fresh] C -- No --> F[AI Call - fresh] ``` ## Configuration ### Constructor Options ```javascript const testdriver = new TestDriver({ cache: { enabled: true, thresholds: { find: { screen: 0.05, // 5% pixel diff allowed (default) element: 0.8, // 80% OpenCV correlation required (default) }, assert: 0.05,