The bldr test command runs test targets with support for parallel execution, result caching, retry logic, and CI/CD integration.
# Run all tests
bldr test
# Run specific test target
bldr test //path/to:test-target
# Run with verbose output
bldr test --verbose
# Run tests quietly (errors only)
bldr test --quietCreate a .buildertest configuration file for persistent settings:
bldr test --init-configThis generates a JSON config file. Command-line flags override config file settings.
Output Control:
bldr test -v, --verbose # Detailed output
bldr test -q, --quiet # Minimal output
bldr test --show-passed # Show passed testsExecution Control:
bldr test --fail-fast # Stop on first failure
bldr test -j, --jobs N # Number of parallel jobs (0 = auto)
bldr test --shards N # Number of test shards
bldr test --no-shard # Disable test shardingCaching & Retry:
bldr test --no-cache # Disable test result caching
bldr test --no-retry # Disable automatic retry
bldr test --max-retries N # Maximum retry attemptsReporting:
bldr test --analytics # Generate analytics report
bldr test --junit [PATH] # Generate JUnit XML report
bldr test --mode MODE # Render mode: auto, interactive, plainBuilder discovers tests in several ways:
- Explicit Test Targets: Targets with
type: testin Builderfile - Convention-Based: Files matching test patterns (
test_*.py,*_test.go, etc.) - Zero-Config: Automatic detection in projects without Builderfile
Discovering tests...
Found 3 test targets
✓ //core:unit-tests (123 ms)
✓ //api:integration-tests (456 ms) [cached]
✗ //services:load-tests (789 ms)
Error: Test assertion failed
✗ test_high_load
Expected: 1000, Got: 850
Test Summary:
Passed: 2
Failed: 1
Cached: 1
Total execution time: 1368ms
Generate JUnit-compatible XML for CI/CD systems:
bldr test --junit test-results.xml- name: Run tests
run: bldr test --junit test-results.xml
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: test-results.xmltest:
script:
- bldr test --junit test-results.xml
artifacts:
reports:
junit: test-results.xmltarget("unit-tests") {
type: test;
language: python;
sources: ["tests/test_*.py"];
deps: ["//src:mylib"];
}
target("integration-tests") {
type: test;
language: go;
sources: ["tests/integration/*_test.go"];
deps: ["//internal:server"];
}
Python:
target("tests") {
type: test;
language: python;
sources: ["tests/"];
}
Builder auto-detects pytest, unittest, or nose based on project configuration.
Go:
target("tests") {
type: test;
language: go;
sources: ["**/*_test.go"];
}
JavaScript/TypeScript:
target("tests") {
type: test;
language: javascript;
sources: ["tests/**/*.test.js"];
}
Builder auto-detects Jest, Mocha, Vitest, or falls back to npm test.
Builder caches test results based on:
- Test source files
- Source code under test
- Test configuration
- External dependencies
Tests are re-run when any of these change.
- Cache Hit: Test skipped, previous result reported
- Cache Miss: Test executed normally
- Force Rerun: Use
--no-cache
| Language | Test Frameworks |
|---|---|
| Python | pytest, unittest, nose |
| JavaScript | Jest, Mocha, Vitest |
| TypeScript | Jest, Mocha, Vitest |
| Go | go test |
| Rust | cargo test |
| Java | JUnit, TestNG |
| C++ | Google Test, Catch2 |
| C# | NUnit, xUnit, MSTest |
| F# | Expecto, NUnit, xUnit |
| Ruby | RSpec, Minitest, Cucumber |
| PHP | PHPUnit, Pest, Codeception |
| Elixir | ExUnit |
| Lua | Busted, LuaUnit |
| R | testthat, tinytest |
| Perl | Test::More, Prove |
| Scala | ScalaTest, Specs2 |
| Kotlin | JUnit, kotest |
0: All tests passed1: One or more tests failed
# Run all tests with full reporting
bldr test --verbose --junit test-results.xml
# Quick unit test run
bldr test --fail-fast
# Run specific target
bldr test //tests:unit# CI-friendly: plain output, JUnit export
bldr test --mode plain --junit results.xml# Generate performance analytics
bldr test --analytics- Check target type:
type: test - Verify source patterns match files
- Use
bldr inferto see auto-detection - Check
.builderignoreisn't excluding tests
- Check if test files have timestamps changing
- Verify dependencies are stable
- Look for random/time-dependent tests
- Check environment variables
- Use
--fail-fastto stop on first failure - Check for race conditions in parallel tests
- Review test isolation
- Use
--analyticsto identify patterns