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.
The test command performs the following actions:
The --include and --exclude options support powerful pattern matching:
* matches any characters within a nameFunctionName::TestName matches a specific test in a specific functionFunctionName:: matches all tests in a function::TestName matches a test name across all functionsControl the number of tests running simultaneously:
The test command automatically loads environment variables:
Environment variables can also be set directly:
The test command returns different exit codes based on results:
Tests are defined in BAML files using the test block syntax:
baml dev - Development server with hot reload for interactive testingbaml serve - Production server for HTTP API testingbaml generate - Generate client code before running tests