Debug test execution with detailed diagnostics and troubleshooting tools.
Synopsis
wheels test debug [spec] [options]
Description
The wheels test debug command provides advanced debugging capabilities for your test suite. It helps identify why tests are failing, diagnose test environment issues, and provides detailed execution traces for troubleshooting complex test problems.
Arguments
Argument
Description
Default
spec
Specific test spec to debug
All tests
Options
Option
Description
Default
--bundles
Test bundles to debug
All bundles
--labels
Filter by test labels
None
--breakpoint
Set breakpoint at test
None
--step
Step through test execution
false
--trace
Show execution trace
false
--verbose
Verbose output level (1-3)
1
--slow
Highlight slow tests (ms)
1000
--dump-context
Dump test context
false
--inspect
Enable remote debugging
false
--port
Debug port for inspection
9229
--pause-on-failure
Pause when test fails
false
--replay
Replay failed tests
false
--help
Show help information
Examples
Debug specific test
wheels test debug UserModelTest
Debug with execution trace
wheels test debug --trace
Step through test execution
wheels test debug UserModelTest.testValidation --step
Debug with breakpoints
wheels test debug --breakpoint=UserModelTest.testLogin:15
Enable remote debugging
wheels test debug --inspect --port=9229
Debug slow tests
wheels test debug --slow=500 --verbose=2
Debug Output
Basic Debug Info
🔍 Test Debug Session Started
================================
Environment: testing
Debug Level: 1
Test Framework: TestBox 5.0.0
CFML Engine: Lucee 5.3.9.141
Running: UserModelTest.testValidation
Status: RUNNING
[DEBUG] Setting up test case...
[DEBUG] Creating test user instance
[DEBUG] Validating empty user
[DEBUG] Assertion: user.hasErrors() = true ✓
[DEBUG] Test completed in 45ms
Verbose Trace Output
With --trace --verbose=3:
🔍 Test Execution Trace
======================
▶ UserModelTest.setup()
└─ [0.5ms] Creating test database transaction
└─ [1.2ms] Loading test fixtures
└─ [0.3ms] Initializing test context
▶ UserModelTest.testValidation()
├─ [0.1ms] var user = model("User").new()
│ └─ [2.1ms] Model instantiation
│ └─ [0.5ms] Property initialization
├─ [0.2ms] user.validate()
│ └─ [5.3ms] Running validations
│ ├─ [1.2ms] Checking required fields
│ ├─ [2.1ms] Email format validation
│ └─ [2.0ms] Custom validations
├─ [0.1ms] expect(user.hasErrors()).toBe(true)
│ └─ [0.3ms] Assertion passed ✓
└─ [0.1ms] Test completed
Total Time: 10.2ms
Memory Used: 2.3MB
Interactive Debugging
Step Mode
With --step:
▶ Entering step mode for UserModelTest.testLogin
[1] user = model("User").findOne(where="email='test@example.com'")
> (n)ext, (s)tep into, (c)ontinue, (v)ariables, (q)uit: v
Variables:
- arguments: {}
- local: { user: [undefined] }
- this: UserModelTest instance
> n
[2] expect(user.authenticate("password123")).toBe(true)
> v
Variables:
- arguments: {}
- local: { user: User instance {id: 1, email: "test@example.com"} }
> s
[2.1] Entering: user.authenticate("password123")
Parameters: { password: "password123" }
Breakpoints
Set breakpoints in code:
// In test file
function testComplexLogic() {
var result = complexCalculation(data);
debugBreak(); // Execution pauses here
expect(result).toBe(expectedValue);
}
Or via command line:
wheels test debug --breakpoint=OrderTest.testCalculateTotal:25
✗ Test Failed: UserModelTest.testUniqueEmail
Test paused at failure point.
Failure Details:
- Expected: true
- Actual: false
- Location: UserModelTest.cfc:45
Debug Options:
(i) Inspect variables
(s) Show stack trace
(d) Dump database state
(r) Retry test
(c) Continue
(q) Quit
> i
Local Variables:
- user1: User { email: "test@example.com", id: 1 }
- user2: User { email: "test@example.com", errors: ["Email already exists"] }
Stack Trace Analysis
Stack Trace:
-----------
1. TestBox.expectation.toBe() at TestBox/system/Expectation.cfc:123
2. UserModelTest.testUniqueEmail() at tests/models/UserModelTest.cfc:45
3. TestBox.runTest() at TestBox/system/BaseSpec.cfc:456
4. Model.validate() at wheels/Model.cfc:789
5. Model.validatesUniquenessOf() at wheels/Model.cfc:1234
Test Replay
Replay Failed Tests
wheels test debug --replay
Replays last failed tests with debug info:
Replaying 3 failed tests from last run...
1/3 UserModelTest.testValidation
- Original failure: Assertion failed at line 23
- Replay status: PASSED ✓
- Possible flaky test
2/3 OrderControllerTest.testCheckout
- Original failure: Database connection timeout
- Replay status: FAILED ✗
- Consistent failure