Debug test execution with detailed diagnostics and troubleshooting tools.
Synopsis
wheelstestdebug [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.
Options
Option
Description
Default
type
Type of tests to run: app, core, or plugin
app
spec
Specific test spec to run (e.g., models.user)
servername
Name of server to reload
(current server)
--reload
Force a reload of wheels (boolean flag)
false
--break-on-failure
Stop test execution on first failure (boolean flag)
true
output-level
Output verbosity: 1=minimal, 2=normal, 3=verbose
3
Examples
Debug all app tests
wheels test debug
Debug specific test spec
wheels test debug spec=models.user
Debug with minimal output
wheels test debug output-level=1
Debug without stopping on failure
wheels test debug --break-on-failure=false
Debug core framework tests
wheels test debug type=core --reload
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='[email protected]'")
> (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: "[email protected]"} }
> 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: "[email protected]", id: 1 }
- user2: User { email: "[email protected]", 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