Contents
Scout: When AI Reads Your Code and Writes Tests for You
Imagine having 50 components with forms, buttons and navigation. QA needs scenarios. A developer says, “There are data-testids; just write tests.” The QA engineer sighs and starts examining every component manually.
Scout automates the process: it reads your source code and generates Playwright tests.
The problem: tests from code versus tests from the UI
There are two approaches to generating tests.
Dynamic analysis (runtime)
Run the application → Explore the UI → Extract elements → Generate testsAdvantage: Sees the application's actual state.
Disadvantage: Requires a running application and is slower.
Static analysis (source code)
Read source code → Analyze components → Generate testsAdvantage: Does not need a running application and is faster.
Disadvantage: Cannot see runtime behavior.
Scout uses static analysis: it reads code and generates tests directly from it. This is ideal for CI/CD without a staging server, quick generation during development and analysis before deployment.
What does Scout do?
Scout has three main capabilities:
1. ANALYZE → Scans the project and extracts forms, buttons and links
2. MARK → Calls Marker to add data-testid
3. GENERATE → LLM generates test scenariosOutput:
- JSON scenarios compatible with Sentinel
- Python tests using Playwright and Pytest
Example workflow
# 1. Analyze the project
python main.py analyze /path/to/frontend
# Output:
# Found 47 components
# - 12 forms with 38 input fields
# - 45 buttons (23 with click handlers)
# - 67 data-testid attributes
# - 15 navigation links
# 2. Generate scenarios
python main.py generate /path/to/frontend
# Output:
# Generated 156 test scenarios
# - 47 happy path scenarios
# - 62 validation scenarios
# - 31 navigation scenarios
# - 16 edge case scenariosHow does Scout analyze code?
Scout uses regex patterns to detect elements in different frameworks.
Angular detection
<!-- Scout recognizes -->
<form [formGroup]="contactForm" (ngSubmit)="onSubmit()">
<input formControlName="email" [required]="true">
<button type="submit" data-testid="btn-submit">Send</button>
</form>
<a routerLink="/about">About</a>Extracted information:
- A form with formGroup “contactForm”
- An input with formControlName “email” and required validation
- A button with data-testid “btn-submit”
- A RouterLink to “/about”
React/JSX detection
// Scout recognizes
<form onSubmit={handleSubmit}>
<input
type="email"
required
data-testid="input-email"
onChange={(e) => setEmail(e.target.value)}
/>
<button type="submit">Submit</button>
</form>
<Link to="/dashboard">Dashboard</Link>Vue detection
<!-- Scout recognizes -->
<template>
<form @submit.prevent="submitForm">
<input v-model="email" required data-testid="input-email">
<button type="submit">Submit</button>
</form>
<router-link :to="{ name: 'home' }">Home</router-link>
</template>Intelligent URL inference
Scout infers the page URL from the file path:
# Angular pattern
src/app/pages/contact/contact.component.html
→ URL: /contact
# Vue/Nuxt pattern
pages/about/index.vue
→ URL: /about
# React pattern
src/pages/Dashboard.tsx
→ URL: /dashboardThis allows it to generate tests with the correct page.goto() calls.
What does Scout generate?
1. Sentinel JSON format
{
"id": "contact-ecbaee-successful-form-submission-00",
"name": "Successful form submission with valid data",
"description": "Tests that the contact form can be submitted successfully",
"page_url": "/contact",
"steps": [
{
"action": "fill",
"selector": "[data-testid=\"input-name\"]",
"value": "John Doe",
"description": "Fill name field"
},
{
"action": "fill",
"selector": "[data-testid=\"input-email\"]",
"value": "john.doe@example.com",
"description": "Fill email field with valid format"
},
{
"action": "click",
"selector": "[data-testid=\"btn-submit\"]",
"value": "",
"description": "Click submit button"
},
{
"action": "verify_visible",
"selector": ".success-message",
"value": "",
"description": "Verify success message appears"
}
]
}2. Playwright Python tests
import pytest
from playwright.sync_api import Page
def test_successful_form_submission_with_valid_data(page: Page, base_url: str):
"""Tests that the contact form can be submitted successfully"""
page.goto(f"{base_url}/contact")
# Fill name field
page.locator("[data-testid=\"input-name\"]").fill("John Doe")
# Fill email field with valid format
page.locator("[data-testid=\"input-email\"]").fill("john.doe@example.com")
# Click submit button
page.locator("[data-testid=\"btn-submit\"]").click()
# Verify success message appears
expect(page.locator(".success-message")).to_be_visible()
def test_form_validation_required_fields(page: Page, base_url: str):
"""Tests that required field validation works correctly"""
page.goto(f"{base_url}/contact")
# Try to submit empty form
page.locator("[data-testid=\"btn-submit\"]").click()
# Verify validation errors appear
expect(page.locator(".error-message")).to_be_visible()Tests can run immediately with pytest.
Types of generated scenarios
Scout generates four categories:
1. Happy path
def test_successful_login():
# Fill valid data → expect success2. Validation tests
def test_email_format_validation():
# Fill an invalid email → expect an error
def test_required_field_validation():
# Leave a required field empty → expect an error3. Navigation tests
def test_navigation_to_about_page():
# Click the link → verify the correct page4. Edge cases
def test_form_with_special_characters():
# Enter special characters → verify behaviorScout understands validation
Scout detects validation rules in your code:
// Angular Reactive Forms
this.form = this.fb.group({
email: ['', [Validators.required, Validators.email]],
phone: ['', [Validators.pattern(/^\d{10}$/)]],
age: ['', [Validators.min(18), Validators.max(100)]]
});Scout generates tests for:
- ✅ Required fields
- ✅ Email format
- ✅ Pattern matching
- ✅ Minimum/maximum values
<!-- HTML5 validation -->
<input type="email" required minlength="5" maxlength="100">Scout also recognizes HTML5 attributes and generates appropriate tests.
Scout architecture
┌─────────────────────────────────────────────────────┐
│ User Interface │
│ CLI │ gRPC Server │ MCP Server │
└──────────────────────┬──────────────────────────────┘
↓
┌─────────────────────────────────────────────────────┐
│ CodeAnalyzer │
│ - Scans .html, .jsx, .tsx, .vue │
│ - Regex extraction of forms, buttons and links │
│ - Validation rule detection │
│ - URL inference from file path │
└──────────────────────┬──────────────────────────────┘
↓
┌─────────────────────────────────────────────────────┐
│ ScenarioGenerator │
│ - Ollama + Qwen3-Coder LLM │
│ - Prompt building from analysis │
│ - JSON parsing with error recovery │
│ - Generation of unique IDs │
└──────────────────────┬──────────────────────────────┘
↓
┌──────────────────┬──────────────────────────────────┐
│ Sentinel JSON │ Playwright Tests │
│ (scenarios) │ (pytest) │
└──────────────────┴──────────────────────────────────┘Integration with Marker
Scout can call the Marker service to add data-testid:
# Start the Marker gRPC server
cd ../marker && python grpc_server.py
# Scout adds test IDs and generates scenarios
python main.py full /path/to/frontendWorkflow:
1. Scout analyzes components
2. Scout calls Marker → adds data-testid
3. Scout analyzes again (now with test IDs)
4. Scout generates scenariosThree ways to use it
1. CLI
# Analysis only
python main.py analyze /path/to/frontend
# Scenario generation only
python main.py generate /path/to/frontend --output ./tests
# Complete workflow
python main.py full /path/to/frontend
# With a custom user for multi-role testing
python main.py generate /path --user admin --role administrator2. gRPC server
# Start the server
python main.py grpc-server --port 50052
# Call from any language
# Service: ScoutService
# Methods: Analyze, Generate, FullWorkflow3. MCP server (Claude integration)
// claude_desktop_config.json
{
"mcpServers": {
"scout": {
"command": "python",
"args": ["main.py", "mcp-server"]
}
}
}In Claude:
"Analyze my Angular project and generate tests for the contact form"
→ Claude calls scout_analyze + scout_generateScout vs Sentinel: when to use each
| Aspect | Scout | Sentinel |
|---|---|---|
| Approach | Static code analysis | Dynamic UI analysis |
| Requires | Source code | A running application |
| Speed | Faster | Slower; navigates the UI |
| Coverage | Everything in code | Only what it sees in the UI |
| Validation | Understands validators | Tests real behavior |
| Ideal for | CI/CD and development | QA and acceptance testing |
The best approach: use both!
# 1. Scout for development (fast, from code)
scout generate ./frontend
# 2. Sentinel for QA (precise, from the UI)
sentinel analyze https://staging.app.comComplete QA toolchain
Marker + Scout + Sentinel make a complete stack:
┌─────────────────────────────────────────────────────┐
│ MARKER │
│ Adds data-testid to components │
│ (Automatic element labeling) │
└──────────────────────┬──────────────────────────────┘
↓
┌─────────────────────────────────────────────────────┐
│ SCOUT │
│ Analyzes code → generates scenarios │
│ (Static analysis + LLM) │
└──────────────────────┬──────────────────────────────┘
↓
┌─────────────────────────────────────────────────────┐
│ SENTINEL │
│ Explores running app → validates scenarios │
│ (Dynamic analysis + LLM) │
└──────────────────────┬──────────────────────────────┘
↓
┌─────────────────────────────────────────────────────┐
│ PLAYWRIGHT / PYTEST │
│ Runs automated tests │
└─────────────────────────────────────────────────────┘Practical workflow:
# 1. Marker: Add data-testid
python marker/main.py add --project ./frontend
# 2. Scout: Generate tests from code
python scout/main.py generate ./frontend --output ./tests
# 3. (Optional) Sentinel: validate on staging
python sentinel/main.py --url https://staging.app.com
# 4. Run tests
pytest ./tests --base-url https://staging.app.comPractical example: contact form
Input (Angular component)
<!-- contact.component.html -->
<form [formGroup]="contactForm" (ngSubmit)="onSubmit()">
<div class="form-group">
<label for="name">Name</label>
<input
id="name"
formControlName="name"
data-testid="input-contact-name"
required>
</div>
<div class="form-group">
<label for="email">Email</label>
<input
id="email"
type="email"
formControlName="email"
data-testid="input-contact-email"
required>
</div>
<div class="form-group">
<label for="message">Message</label>
<textarea
id="message"
formControlName="message"
data-testid="textarea-contact-message"
minlength="10">
</textarea>
</div>
<button type="submit" data-testid="btn-contact-submit">
Send Message
</button>
</form>Output (Playwright tests)
# test_contact.py - generated by Scout
def test_successful_contact_form_submission(page: Page, base_url: str):
"""Test successful form submission with valid data"""
page.goto(f"{base_url}/contact")
page.locator("[data-testid=\"input-contact-name\"]").fill("John Doe")
page.locator("[data-testid=\"input-contact-email\"]").fill("john@example.com")
page.locator("[data-testid=\"textarea-contact-message\"]").fill("Hello, this is a test message.")
page.locator("[data-testid=\"btn-contact-submit\"]").click()
def test_contact_form_required_name(page: Page, base_url: str):
"""Test that name field is required"""
page.goto(f"{base_url}/contact")
# Leave name empty, fill other fields
page.locator("[data-testid=\"input-contact-email\"]").fill("john@example.com")
page.locator("[data-testid=\"textarea-contact-message\"]").fill("Test message here.")
page.locator("[data-testid=\"btn-contact-submit\"]").click()
# Verify form was not submitted
expect(page.locator("[data-testid=\"input-contact-name\"]")).to_have_attribute("aria-invalid", "true")
def test_contact_form_email_validation(page: Page, base_url: str):
"""Test that email format is validated"""
page.goto(f"{base_url}/contact")
page.locator("[data-testid=\"input-contact-name\"]").fill("John")
page.locator("[data-testid=\"input-contact-email\"]").fill("invalid-email")
page.locator("[data-testid=\"btn-contact-submit\"]").click()
# Verify email validation error
def test_contact_form_message_minlength(page: Page, base_url: str):
"""Test that message has minimum length requirement"""
page.goto(f"{base_url}/contact")
page.locator("[data-testid=\"input-contact-name\"]").fill("John")
page.locator("[data-testid=\"input-contact-email\"]").fill("john@example.com")
page.locator("[data-testid=\"textarea-contact-message\"]").fill("Short") # < 10 chars
page.locator("[data-testid=\"btn-contact-submit\"]").click()
# Verify minlength validationFour tests from one form, without manual work.
Quick start
# 1. Install Ollama and the model
ollama pull qwen3-coder:30b
# 2. Configure .env
cat > .env << EOF
PROJECT_PATH=/path/to/frontend
OLLAMA_HOST=http://localhost:11434
LLM_MODEL=qwen3-coder:30b
OUTPUT_DIR=./result
EOF
# 3. Analyze the project
python main.py analyze /path/to/frontend
# 4. Generate tests
python main.py generate /path/to/frontend
# 5. Run tests
pytest result/tests/ --base-url http://localhost:4200Conclusion
Scout changes the way we create tests:
| Manual approach | With Scout |
|---|---|
| Read code and write tests | Scout reads code for me |
| Forget edge cases | LLM generates validation tests |
| Inconsistent coverage | Systematic analysis of every component |
| Hours of work | Minutes |
When to use Scout:
- ✅ You need tests from existing code
- ✅ A CI/CD pipeline has no staging server
- ✅ You need fast generation during development
- ✅ Analyze coverage before deployment
Scout is your AI QA engineer: it reads code, understands it and writes tests; you review the result.
Scout is part of a QA automation toolchain with Marker and Sentinel. All use local LLMs through Ollama.