Skip to content

coldbox create model --tests generates a failing unit test #72

@edyionescu

Description

@edyionescu

What are the steps to reproduce this issue?

  1. Create a new ColdBox app: coldbox create app name=myApp
  2. Start the server: server start
  3. Create a model with its unit test: coldbox create model User --tests
  4. Run the generated unit test: testbox run bundles=tests.specs.unit.UserTest

What happens?

The test errors immediately with a global bundle exception before any specs run:

GLOBAL BUNDLE EXCEPTION
-> Application:The requested class [User] has not been located in the [bx] resolver.

What were you expecting to happen?

The generated test should run successfully out of the box, with the "can be created" spec passing.

Any logs, error output, etc?

Executing tests http://127.0.0.1:53134/tests/runner.bxm?&directory=&recurse=true&reporter=json&bundles=tests.specs.unit.UserTest&verbose=false please wait...

- tests.specs.unit.UserTest (50 ms)
[Passed: 0] [Failed: 0] [Errors: -1] [Skipped: 0] [Suites/Specs: 0/0]

GLOBAL BUNDLE EXCEPTION
-> Application:The requested class [User] has not been located in the [bx] resolver.:
-> at lib\testbox\system\MockBox.cfc:78

76:             // class to mock
77:             if ( !isNull( arguments.className ) ) {
78:                     obj = createObject( "component", arguments.className );
79:             } else if ( !isNull( arguments.object ) ) {
80:                     // Object to Mock

-> at lib\coldbox\system\testing\BaseModelTest.cfc:27
-> at tests\specs\unit\UserTest.bx:16
-> at lib\testbox\system\runners\BDDRunner.cfc:71
-> at lib\testbox\system\TestBox.cfc:856
---------------------------------------------------------------------------------

╔═════════════════════════════════════════════════════════════════════╗
║ Passed  ║ Failed  ║ Errored ║ Skipped ║ Bundles ║ Suites  ║ Specs   ║
╠═════════════════════════════════════════════════════════════════════╣
║ 0       ║ 0       ║ -1      ║ 0       ║ 1       ║ 0       ║ 0       ║
╚═════════════════════════════════════════════════════════════════════╝

TestBox         v7.0.0
CFML Engine     BoxLang v1.13.0+54

Any other comments?

The issue is present in both flat and modern app layouts.

What versions are you using?

Operating System: Windows 11 Pro 25H2
Package Version: 8.12.0+30

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions