Skip to main content
FTL can generate adversarial tests in parallel with the coding agent, creating tests that actively try to break the implementation before the code is even complete.

How It Works

The adversarial testing system runs a separate model alongside the primary coding agent:
  1. Task-based generation - Tests are generated from the task description alone, without seeing the implementation
  2. Parallel execution - The tester runs at the same time as the coder, not after
  3. Adversarial focus - Tests target edge cases, null inputs, boundary conditions, and unexpected usage
  4. Real API testing - No mocking - tests use actual API credentials from the environment

Test Generation Strategy

The test generator receives this system prompt:
You are an adversarial test engineer. Given a coding task description, generate a test script that verifies the implementation is correct and tries to break it. Focus on edge cases, null inputs, boundary conditions, and unexpected usage. Your goal is to find bugs.
Key characteristics:
  • Language detection - Automatically detects Python vs JavaScript from code patterns
  • Auto-installation - Installs missing test dependencies (pytest, etc.) on first failure
  • Real credentials - Uses environment variables for actual API testing

Language Support

The system detects the language from the generated test code:
Source: ftl/planner.py:63-68
  • Python - Uses pytest with -v flag
  • JavaScript - Runs with node directly

Manual Verification

You can manually trigger verification on code changes:
Source: ftl/planner.py:97-112
Verification can use either a specific model or a full FTL agent for more sophisticated test generation.

Missing Dependencies

The test runner automatically handles missing modules:
Source: ftl/planner.py:80-84
This extracts package names from ModuleNotFoundError messages and installs them automatically.

Configuration

Adversarial testing is activated by passing a model name to the planner:
The tester can be:
  • A LiteLLM model name (e.g., claude-3-5-sonnet-20241022)
  • An FTL agent name for more advanced testing

Benefits

Catch Bugs Early

Find issues before the agent even finishes coding

No Mocking

Tests use real APIs with actual credentials

Edge Case Focus

Adversarial mindset finds boundary conditions

Auto-Install

Missing test dependencies installed automatically