Skip to content

Commit 5970a4f

Browse files
committed
Merge branch 'development'
2 parents 741c725 + 3eb79a3 commit 5970a4f

20 files changed

Lines changed: 753 additions & 132 deletions

.github/copilot-instructions.md

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
# Copilot Instructions for TestBox
2+
3+
## Project Overview
4+
5+
TestBox is the leading BDD/TDD testing framework for BoxLang and CFML applications. It supports both BDD (Behavior-Driven Development) and xUnit testing styles, providing a comprehensive testing ecosystem with built-in mocking capabilities (MockBox), multiple reporters, and CLI/web test runners. BoxLang is now the primary focus while maintaining full CFML compatibility.
6+
7+
## Architecture & Core Components
8+
9+
### Core Testing Engine
10+
- **TestBox.cfc** (`system/TestBox.cfc`): Main orchestrator handling test execution, bundle discovery, and result aggregation
11+
- **BaseSpec.cfc** (`system/BaseSpec.cfc`): Base class for all test specs - provides both BDD DSL (`describe()`, `it()`, `beforeEach()`) and xUnit methods (`setup()`, `test*()`, `tearDown()`)
12+
- **Expectation.cfc** (`system/Expectation.cfc`): BDD assertion engine with fluent matcher API (`expect().toBe()`, `expect().notToBeEmpty()`)
13+
- **MockBox.cfc** (`system/MockBox.cfc`): Standalone mocking framework for creating spies, stubs, and mocks
14+
15+
### Multi-Language Support Pattern
16+
- **BoxLang Primary**: `.bx` files supported with dedicated `BoxLangRunner.bx` CLI runner
17+
- **CFML Compatibility**: `.cfc` files with traditional CFML runners (`BDDRunner.cfc`, `UnitRunner.cfc`)
18+
- **File Discovery**: Default bundle pattern `*Spec*.cfc|*Test*.cfc|*Spec*.bx|*Test*.bx`
19+
20+
### Code Formatting Standards
21+
- **Spacing Requirements**: All code must include spacing on all markers for improved readability (`.cfformat.json`)
22+
- **Key Rules**: Padding in brackets `( condition )`, function calls `func( arg )`, structs `{ key : value }`, arrays `[ item, item ]`
23+
- **Operators**: Binary operators require padding `a + b`, `x == y`
24+
- **Alignment**: Consecutive assignments, properties, and parameters are aligned
25+
- **Indentation**: 4-space tabs, max 115 columns, double quotes for strings
26+
27+
### Reporter Architecture
28+
- **Interface-Driven**: All reporters implement `IReporter.cfc` interface
29+
- **Multi-Format Output**: HTML, JSON, XML, Console, TAP, JUnit, ANT-JUnit formats
30+
- **Context-Aware**: CLI mode defaults to `text` reporter, web mode defaults to `simple` reporter
31+
32+
## Critical Developer Workflows
33+
34+
### Test Bundle Structure Pattern
35+
```javascript
36+
// BDD Style - All test specs must extend BaseSpec
37+
component extends="testbox.system.BaseSpec" {
38+
function run() {
39+
describe("Feature Name", function() {
40+
beforeEach(function() { /* setup */ });
41+
it("should do something", function() {
42+
expect(actual).toBe(expected);
43+
});
44+
});
45+
}
46+
}
47+
48+
// xUnit Style - Traditional unit testing approach
49+
component extends="testbox.system.BaseSpec" {
50+
function setup() {
51+
// Global setup before each test
52+
}
53+
54+
function testSomething() {
55+
var actual = someFunction();
56+
$assert.isEqual(expected, actual);
57+
}
58+
59+
function tearDown() {
60+
// Cleanup after each test
61+
}
62+
}
63+
```
64+
65+
### CLI Testing via BoxLang Runner
66+
```bash
67+
# Primary CLI execution method
68+
./testbox/bin/run # Run default tests.specs
69+
./testbox/bin/run --directory=my.tests # Specific directory
70+
./testbox/bin/run --bundles=my.bundle # Specific bundles
71+
./testbox/bin/run --reporter=json # Custom reporter
72+
```
73+
74+
### Web Testing Setup
75+
- **HTMLRunner.cfm**: Web-based test execution endpoint
76+
- **Application.cfc**: Sets up TestBox mappings and routes
77+
- **URL Parameters**: `?method=runRemote&bundles=...&reporter=...`
78+
79+
### Build & Development Commands
80+
```bash
81+
# Format code (BoxLang + CFML)
82+
box run-script format
83+
84+
# Multi-engine testing
85+
box run-script start:lucee
86+
box run-script start:2023
87+
88+
# Release process
89+
box run-script release
90+
```
91+
92+
## Key Implementation Patterns
93+
94+
### Dual Testing Approach
95+
- **BDD Style**: Uses `describe()`, `it()`, `beforeEach()`, `afterEach()` for behavior specification
96+
- **xUnit Style**: Uses `setup()`, `test*()`, `tearDown()` methods for traditional unit testing
97+
- **Assertion Methods**: BDD uses `expect()` fluent API, xUnit uses `$assert` object methods
98+
- **Mixed Usage**: Both styles can coexist within the same test bundle
99+
100+
### BDD DSL Implementation
101+
- **Suite Nesting**: `describe()` blocks create nested test suites stored in `this.$suites` array
102+
- **Execution Context**: `this.$suiteContext` tracks current suite being defined
103+
- **Lifecycle Hooks**: `beforeEach()`, `afterEach()`, `beforeAll()`, `afterAll()` stored per suite
104+
105+
### xUnit Pattern Implementation
106+
- **Method Discovery**: Test methods automatically discovered by `test*` prefix convention
107+
- **Lifecycle Methods**: `setup()` and `tearDown()` called before/after each test method
108+
- **Global Hooks**: `beforeTests()` and `afterTests()` for bundle-level setup/cleanup
109+
- **Assertion Object**: `$assert` provides traditional assertion methods (`isEqual()`, `isTrue()`, `isNull()`)
110+
111+
### MockBox Integration Pattern
112+
```javascript
113+
// MockBox is integrated into BaseSpec - comprehensive mocking framework
114+
var mockService = createMock( "path.to.Service" );
115+
mockService.$( "methodName" ).$results( "mockValue" );
116+
mockService.$( "methodName", "arg1" ).$args( "arg1" ).$results( "specificResult" );
117+
118+
// Advanced mocking capabilities
119+
var spy = createSpy( targetObject, "methodName" );
120+
var stub = createStub().$( "getData" ).$results( mockData );
121+
var emptyMock = createEmptyMock( "com.interfaces.IService" );
122+
123+
// Verification patterns
124+
expect( mockService.$callLog().getData ).toHaveLength( 1 );
125+
expect( mockService.$times( 2, "methodName" ) ).toBeTrue();
126+
```
127+
128+
### Expectation Chaining Architecture
129+
- **Fluent API**: `expect(actual).toBe(expected).toHaveLength(3)`
130+
- **Negation Pattern**: Dynamic `not` prefix (`expect().notToBe()`)
131+
- **Custom Matchers**: Register via `registerMatcher(name, closure)`
132+
133+
### Coverage Service Integration
134+
- **CoverageService.cfc**: Built-in code coverage analysis
135+
- **Configuration**: Via `options.coverage` struct in TestBox constructor
136+
- **Integration**: Automatic coverage collection during test execution
137+
138+
### Dependency Management
139+
- **cbstreams**: Functional programming utilities for data manipulation and stream processing
140+
- **cbMockData**: Full-featured data mocking library providing realistic test data generation (names, addresses, numbers, dates, lorem text)
141+
- **globber**: File pattern matching and discovery utilities for test bundle location
142+
- **MockBox**: Integrated mocking framework (spies, stubs, mocks) with verification capabilities
143+
- **Installation**: Dependencies auto-installed to `system/modules/` via CommandBox package manager
144+
145+
## Testing Conventions
146+
147+
### File Organization
148+
- **Test Location**: `tests/specs/` directory by convention
149+
- **Naming**: `*Test.cfc`, `*Spec.cfc`, `*Test.bx`, `*Spec.bx` patterns
150+
- **Suite Structure**: Mirror source code directory structure in test folders
151+
152+
### Label-Based Filtering
153+
```javascript
154+
// Suite labeling for selective execution
155+
describe("Feature", { labels: "slow,integration" }, function() {
156+
it("test case", { labels: "unit" }, function() { /* */ });
157+
});
158+
159+
// CLI filtering: --labels=unit --excludes=slow
160+
```
161+
162+
### Focused Testing
163+
- **fdescribe()** / **fit()**: Focus execution on specific suites/specs
164+
- **xdescribe()** / **xit()**: Skip suites/specs during development
165+
166+
## Integration Points
167+
168+
### ColdBox Framework Integration
169+
- **Enhanced BaseSpec**: ColdBox provides extended base spec with framework-specific helpers
170+
- **Application Testing**: Built-in request/response simulation for integration tests
171+
- **Service Mocking**: Deep integration with WireBox for dependency injection testing
172+
173+
### CommandBox Integration
174+
- **TestBox CLI**: `testbox-cli` package provides `testbox run` commands
175+
- **File Watching**: Automatic test re-execution on file changes
176+
- **CI/CD Integration**: JUnit/TAP/JSON output formats for build systems
177+
178+
### Standalone Usage
179+
- **Framework Agnostic**: Can test any BoxLang/CFML application
180+
- **Mapping Requirements**: Requires `/testbox` mapping to system directory
181+
- **Web Server**: Can run via any CFML web server (Lucee, Adobe CF, CommandBox)
182+
183+
## Development Commands
184+
185+
```bash
186+
# Core development workflow
187+
box install # Install dependencies
188+
box run-script format # Format all code (.cfformat.json rules)
189+
box run-script format:check # Check formatting without changes
190+
box run-script format:watch # Auto-format on file changes
191+
box run-script start:lucee # Start development server
192+
./testbox/bin/run # Run tests via BoxLang CLI
193+
194+
# Multi-engine testing
195+
box run-script start:adobe # Adobe CF 2025
196+
box run-script start:boxlang # BoxLang server
197+
box run-script log:lucee # View server logs
198+
box run-script log:adobe # View Adobe CF logs
199+
box run-script log:boxlang # View BoxLang logs
200+
```

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
# GitHub Actions - updates uses: statements in workflows
4+
- package-ecosystem: "github-actions"
5+
directory: "/" # Where your .github/workflows/ folder is
6+
schedule:
7+
interval: "monthly"

.github/workflows/pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
runs-on: ubuntu-latest
2323
steps:
2424
- name: Checkout Repository
25-
uses: actions/checkout@v4
25+
uses: actions/checkout@v5
2626

2727
- uses: Ortus-Solutions/commandbox-action@v1.0.2
2828
with:

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ jobs:
2929
runs-on: ubuntu-latest
3030
steps:
3131
- name: Checkout Repository
32-
uses: actions/checkout@v4
32+
uses: actions/checkout@v5
3333

3434
- name: Setup Java
35-
uses: actions/setup-java@v4
35+
uses: actions/setup-java@v5
3636
with:
3737
distribution: "temurin"
3838
java-version: "17"
@@ -162,7 +162,7 @@ jobs:
162162
steps:
163163
# Checkout development
164164
- name: Checkout Repository
165-
uses: actions/checkout@v4
165+
uses: actions/checkout@v5
166166
with:
167167
ref: development
168168

.github/workflows/snapshot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
name: Code Auto-Formatting
2727
runs-on: ubuntu-latest
2828
steps:
29-
- uses: actions/checkout@v4
29+
- uses: actions/checkout@v5
3030

3131
- name: Auto-format
3232
uses: Ortus-Solutions/commandbox-action@v1.0.2

.github/workflows/tests.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
secrets:
77
SLACK_WEBHOOK_URL:
88
required: false
9+
# Allow manual triggering
10+
workflow_dispatch:
911

1012
jobs:
1113
tests:
@@ -15,22 +17,26 @@ jobs:
1517
strategy:
1618
fail-fast: false
1719
matrix:
18-
commandbox_version: [ "6.1.0" ]
19-
cfengine: [ "boxlang@1", "boxlang-cfml@1", "lucee@5", "lucee@6", "adobe@2023" ]
20+
commandbox_version: [ "6.2.1" ]
21+
cfengine: [ "boxlang@1", "boxlang-cfml@1", "lucee@5", "lucee@6", "adobe@2023", "adobe@2025" ]
2022
jdkVersion: [ "21" ]
2123
experimental: [ false ]
2224
include:
2325
# Old Supported One
2426
- cfengine: "adobe@2021"
25-
commandbox_version: "6.1.0"
27+
commandbox_version: "6.2.1"
2628
jdkVersion: "11"
2729
experimental: false
30+
- cfengine: "boxlang@be"
31+
commandbox_version: "6.2.1"
32+
jdkVersion: "21"
33+
experimental: true
2834
steps:
2935
- name: Checkout Repository
30-
uses: actions/checkout@v4
36+
uses: actions/checkout@v5
3137

3238
- name: Setup Java
33-
uses: actions/setup-java@v4
39+
uses: actions/setup-java@v5
3440
with:
3541
distribution: "temurin"
3642
java-version: ${{ matrix.jdkVersion }}

box.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name":"TestBox",
3-
"version":"6.3.2",
3+
"version":"6.4.0",
44
"location":"https://downloads.ortussolutions.com/ortussolutions/testbox/@build.version@/testbox-@build.version@.zip",
55
"author":"Ortus Solutions <info@ortussolutions.com>",
66
"slug":"testbox",
@@ -41,8 +41,7 @@
4141
"globber":"^3.1.3"
4242
},
4343
"devDependencies":{
44-
"commandbox-dotenv":"*",
45-
"commandbox-cfconfig":"*",
44+
"commandbox-boxlang":"*",
4645
"commandbox-cfformat":"*"
4746
},
4847
"installPaths":{
@@ -56,10 +55,10 @@
5655
"format:check":"cfformat check system/**/*.cfc,test-harness/**/*.cfc,tests/specs/**/*.cfc ./.cfformat.json",
5756
"format:watch":"cfformat watch system/**/*.cfc,test-harness/**/*.cfc,tests/specs/**/*.cfc ./.cfformat.json",
5857
"start:lucee":"server start serverConfigFile=server-lucee@5.json",
59-
"start:2021":"server start serverConfigFile=server-adobe@2021.json",
60-
"start:2023":"server start serverConfigFile=server-adobe@2023.json",
58+
"start:adobe":"server start serverConfigFile=server-adobe@2025.json",
59+
"start:boxlang":"server start serverConfigFile=server-boxlang@1.json",
6160
"log:lucee":"server log testbox-lucee@5 --follow",
62-
"log:2021":"server log testbox-adobe@2021 --follow",
63-
"log:2023":"server log testbox-adobe@2023 --follow"
61+
"log:adobe":"server log testbox-adobe@2025 --follow",
62+
"log:boxlang":"server log testbox-boxlang@1 --follow"
6463
}
6564
}

changelog.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
## [Unreleased]
1111

12+
### New Features
13+
14+
- [TESTBOX-423](https://ortussolutions.atlassian.net/browse/TESTBOX-423) BoxLang Prime Updates
15+
16+
### Bugs
17+
18+
- [TESTBOX-421](https://ortussolutions.atlassian.net/browse/TESTBOX-421) \`equalize\` should use the Java \`equals\` check at the end of the function instead of \`false\`
19+
20+
### Tasks
21+
22+
- [TESTBOX-424](https://ortussolutions.atlassian.net/browse/TESTBOX-424) Add Dumb Adobe jvm flags to allow for dynamic arguments
23+
1224
## [6.3.2] - 2025-04-29
1325

1426
## [6.3.1] - 2025-04-01

0 commit comments

Comments
 (0)