How the TestDriver agent behaves on GitHub issues, pull requests, and @mentions
日本語の概要は準備中です。原文の説明を表示しています。
How TestDriver learns your app and caches what it discovers for instant, deterministic replays
インストール方法を見るインストールする前に、エージェントに与えられる指示の中身を確認できます。
After the agent explored your app, TestDriver keeps what it found. TestDriver caches each element that the AI vision agent finds. It uses a vision fingerprint. This is a perceptual hash of the screen state at the element location. On the next run, TestDriver matches against that cache. It does not call the AI again. Tests that pass replay quickly, in the same way each time, and at a low cost.
This learning makes TestDriver fast. The cache makes the test run a maximum of 1.7x faster. It does not do the same AI vision analysis again. The agent thinks only when it sees something new.
// First run: builds cache
await testdriver.find('submit button');
// Second run: exact match
await testdriver.find('submit button');
TestDriver enables learning automatically. You do not need configuration. TestDriver computes the cache key from these. The cache key is the fingerprint that TestDriver uses to know what it learned:
find()When you change your test file, the hash changes automatically. This makes the old cache entries not valid. Then TestDriver does a new AI analysis with your new test logic.
import { test } from 'vitest';
import { chrome } from 'testdriverai/presets';
test('auto-cached test', async (context) => {
const { testdriver } = await chrome(context, {
url: 'https://example.com'
});
// First call: AI analyzes screen, saves to cache
await testdriver.find('More information link'); // 2.1s
// Second call: cache hit, instant response
await testdriver.find('More information link'); // 12ms ⚡
});
You can clear the cache in the TestDriver console. There, you also find previews of cached elements, the input prompts, and analytics on the cache hit rates.
<Card href="https://console.testdriver.ai/cache" title="TestDriver Cache" icon="database"> Manage and clear your test cache from the TestDriver console. </Card>You can track what TestDriver has learned by inspecting cache performance in your tests:
test('monitor cache performance', async (context) => {
const { testdriver } = await chrome(context, { url });
const element = await testdriver.find('submit button');
if (element.cacheHit) {
console.log('✅ Cache hit - instant response');
console.log('Strategy:', element.cacheStrategy); // 'exact', 'pixeldiff', or 'template'
console.log('Similarity:', `${(element.similarity * 100).toFixed(1)}%`);
console.log('Cache age:', element.cacheCreatedAt);
} else {
console.log('⏱️ Cache miss - AI analysis performed');
console.log('New cache entry created');
}
});
You can configure how TestDriver learns globally when initializing TestDriver:
import { TestDriver } from 'testdriverai';
const testdriver = new TestDriver({
apiKey: process.env.TD_API_KEY,
cacheKey: 'my-test-suite', // cache-key for this instance
cacheDefaults: {
threshold: 0.05, // 95% similarity
}
});
It's also possible to override cache settings per find() call:
// Default: 95% similarity required
await testdriver.find('submit button');
// Explicit strict threshold
await testdriver.find('submit button', {
cacheThreshold: 0.01 // 99% similarity
});
Custom cache keys prevent cache pollution when using variables in prompts, dramatically improving cache hit rates—so TestDriver reuses what it learned even when your data changes.
// ❌ Without cache key - creates new cache for each variable value
const email = 'user@example.com';
await testdriver.find(`input for ${email}`); // Cache miss every time
// ✅ With cache key - reuses cache regardless of variable
const email = 'user@example.com';
await testdriver.find(`input for ${email}`, {
cacheKey: 'email-input'
});
// Also useful for dynamic IDs, names, or other changing data
const orderId = generateOrderId();
await testdriver.find(`order ${orderId} status`, {
cacheKey: 'order-status' // Same cache for all orders
});
まだレビューはありません。使ってみた感想をお寄せください。
概要と使いどころ
How the TestDriver agent behaves on GitHub issues, pull requests, and @mentions
日本語の概要は準備中です。原文の説明を表示しています。
Execute natural language tasks using AI
日本語の概要は準備中です。原文の説明を表示しています。
Make AI-powered assertions about screen state
日本語の概要は準備中です。原文の説明を表示しています。
Deploy TestDriver on your AWS infrastructure using CloudFormation
日本語の概要は準備中です。原文の説明を表示しています。
Speed up tests with screenshot-based caching
日本語の概要は準備中です。原文の説明を表示しています。
1.7x faster test execution with intelligent caching and optimization
日本語の概要は準備中です。原文の説明を表示しています。