Loading...

CLI Overview

Quick Start Guide

wheels info

wheels reload

wheels deps

wheels destroy

wheels watch

wheels generate app

wheels generate app-wizard

wheels generate controller

wheels generate model

wheels generate view

wheels generate property

wheels generate route

wheels generate resource

wheels generate api-resource

wheels generate frontend

wheels generate test

wheels generate snippets

wheels scaffold

wheels test

wheels test run

wheels test coverage

wheels test debug

wheels config list

wheels config set

wheels config env

wheels env

wheels env setup

wheels env list

wheels env switch

wheels environment

wheels console

wheels runner

wheels server

wheels server start

wheels server stop

wheels server restart

wheels server status

wheels server log

wheels server open

wheels plugins

wheels plugins list

wheels plugins install

wheels plugins remove

wheels analyze

wheels analyze code

wheels analyze performance

wheels analyze security

wheels security

wheels security scan

wheels optimize

wheels optimize performance

wheels docs

wheels docs generate

wheels docs serve

wheels ci init

wheels docker init

wheels docker deploy

wheels deploy

wheels deploy audit

wheels deploy exec

wheels deploy hooks

wheels deploy init

wheels deploy lock

wheels deploy logs

wheels deploy proxy

wheels deploy push

wheels deploy rollback

wheels deploy secrets

wheels deploy setup

wheels deploy status

wheels deploy stop

Configuration Management

Creating Commands

Service Architecture

Migrations Guide

Testing Guide

Ask or search...
Ctrl K
Loading...

wheels test

⚠️ DEPRECATED: This command is deprecated. Use wheels test run or the advanced testing commands (wheels test:all, wheels test:unit, etc.) instead.

Run Wheels framework tests (core, app, or plugin tests).

Synopsis

wheels test [type] [servername] [options]

Description

The wheels test command runs the built-in Wheels framework test suite. This is different from wheels test run which runs your application's TestBox tests. Use this command to verify framework integrity or test Wheels plugins.

Arguments

| Argument | Description | Default | |----------|-------------|---------| | type | Test type: core, app, or plugin | app | | serverName | CommandBox server name | Current server |

Options

| Option | Description | Default | |--------|-------------|---------| | reload | Reload before running tests | true | | debug | Show debug output | false | | format | Output format | json | | adapter | Test adapter | "" (empty) | | --help | Show help information | |

Test Types

Core Tests

wheels test core
  • Tests Wheels framework functionality
  • Verifies framework integrity
  • Useful after framework updates

App Tests

wheels test app
  • Runs application-level framework tests
  • Tests Wheels configuration
  • Verifies app-specific framework features

Plugin Tests

wheels test plugin
  • Tests installed Wheels plugins
  • Verifies plugin compatibility
  • Checks plugin functionality

Examples

Run app tests (default)

wheels test

Run core framework tests

wheels test core

Run tests on specific server

wheels test type=app serverName=myserver

Run with debug output

wheels test debug=true

Skip reload

wheels test reload=false

Deprecation Notice

⚠️  WARNING: The 'wheels test' command is deprecated.
   Please use 'wheels test run' instead.
   See: wheels help test run

Output Example

╔═══════════════════════════════════════════════╗
║           Running Wheels Tests                ║
╚═══════════════════════════════════════════════╝

Test Type: app
Server: default
Reloading: Yes

Initializing test environment...
✓ Environment ready

Running tests...

Model Tests
  ✓ validations work correctly (15ms)
  ✓ associations load properly (23ms)
  ✓ callbacks execute in order (8ms)

Controller Tests
  ✓ filters apply correctly (12ms)
  ✓ caching works as expected (45ms)
  ✓ provides correct formats (5ms)

View Tests
  ✓ helpers render correctly (18ms)
  ✓ partials include properly (9ms)
  ✓ layouts apply correctly (11ms)

Plugin Tests
  ✓ DBMigrate plugin loads (7ms)
  ✓ Scaffold plugin works (22ms)

╔═══════════════════════════════════════════════╗
║              Test Summary                     ║
╚═══════════════════════════════════════════════╝

Total Tests: 11
Passed: 11
Failed: 0
Errors: 0
Time: 173ms

✓ All tests passed!

Framework Test Categories

Model Tests

  • Validations
  • Associations
  • Callbacks
  • Properties
  • Calculations

Controller Tests

  • Filters
  • Caching
  • Provides/formats
  • Redirects
  • Rendering

View Tests

  • Helper functions
  • Form helpers
  • Asset helpers
  • Partials
  • Layouts

Dispatcher Tests

  • Routing
  • URL rewriting
  • Request handling
  • Parameter parsing

Configuration

Test Settings

In /config/settings.cfm:

<cfset set(testEnvironment=true)>
<cfset set(testDataSource="myapp_test")>

Test Database

Create separate test database:

CREATE DATABASE myapp_test;

Debugging Failed Tests

Enable debug mode

wheels test debug=true

Check specific test file

Failed: Model Tests > validations work correctly
File: /tests/framework/model/validations.cfc
Line: 45
Expected: true
Actual: false

Common issues

  1. Database not configured: Check test datasource
  2. Reload password wrong: Verify settings
  3. Plugin conflicts: Disable plugins and retest
  4. Cache issues: Clear cache and retry

Continuous Integration

GitHub Actions

- name: Run Wheels tests
  run: |
    box install
    box server start
    wheels test core
    wheels test app

Jenkins

stage('Framework Tests') {
    steps {
        sh 'wheels test core'
        sh 'wheels test app'
    }
}

Custom Framework Tests

Add tests in /tests/framework/:

component extends="wheels.Test" {

    function test_custom_framework_feature() {
        // Test custom framework modification
        actual = customFrameworkMethod();
        assert(actual == expected);
    }

}

Performance Testing

Run with timing:

wheels test --debug | grep "Time:"

Monitor slow tests:

✓ complex query test (523ms) ⚠️ SLOW
✓ simple validation (8ms)

Test Isolation

Tests run in isolation:

  • Separate request for each test
  • Transaction rollback (if enabled)
  • Clean application state

Troubleshooting

Tests won't run

# Check server is running
box server status

# Verify test URL
curl http://localhost:3000/wheels/tests

Reload issues

# Manual reload first
wheels reload

# Then run tests
wheels test reload=false

Memory issues

# Increase heap size
box server set jvm.heapSize=512
box server restart

Best Practices

  1. Run before deployment
  2. Test after framework updates
  3. Verify plugin compatibility
  4. Use CI/CD integration
  5. Keep test database clean

Migration to New Command

Old Command (Deprecated)

wheels test app
wheels test core myserver
wheels test debug=true

New Command

wheels test run
wheels test run --group=core
wheels test run --verbose

Difference from TestBox Tests

| Feature | wheels test (deprecated) | wheels test run | |---------|---------------------------|-------------------| | Purpose | Framework tests | Application tests | | Framework | Wheels Test | TestBox | | Location | /wheels/tests/ | /tests/ | | Use Case | Framework integrity | App functionality | | Status | Deprecated | Current |

See Also