test
The test command runs BAML function tests defined in your BAML files. It provides comprehensive testing capabilities including filtering, parallel execution, and various output formats.
Usage
Options
Description
The test command performs the following actions:
- Discovers and parses all test cases defined in BAML files
 - Applies include/exclude filters to select which tests to run
 - Executes tests in parallel (configurable concurrency)
 - Reports results with detailed output and assertions
 - Supports various output formats and CI integration
 
Test Filtering
The --include and --exclude options support powerful pattern matching:
Pattern Syntax
*matches any characters within a nameFunctionName::TestNamematches a specific test in a specific functionFunctionName::matches all tests in a function::TestNamematches a test name across all functions- Multiple patterns can be combined
 
Examples
Parallel Execution
Control the number of tests running simultaneously:
Environment Variables
The test command automatically loads environment variables:
Environment variables can also be set directly:
Exit Codes
The test command returns different exit codes based on results:
Examples
Basic Testing
Development Workflow
CI/CD Integration
Test Discovery
Test Definition
Tests are defined in BAML files using the test block syntax:
Related Commands
baml dev- Development server with hot reload for interactive testingbaml serve- Production server for HTTP API testingbaml generate- Generate client code before running tests