← ClaudeAtlas

boxlang-testinglisted

Use this skill when writing, running, or debugging tests for BoxLang applications using TestBox: BDD-style describe/it specs, xUnit-style test classes, expectations (expect/toBe matchers), assertions ($assert), life-cycle methods (beforeAll/afterAll/beforeEach/afterEach/aroundEach), MockBox mocking (createMock/prepareMock/$()/$results()), mock data generation (mockData()), async testing, exception testing, focused/skipped specs, and running tests via the BoxLang CLI runner.
ortus-boxlang/skills · ★ 0 · Testing & QA · score 58
Install: claude install-skill ortus-boxlang/skills
# BoxLang Testing with TestBox ## Overview TestBox is the standard testing framework for BoxLang. It supports two styles: - **BDD** (Behavior-Driven Development) — `describe()`, `it()`, `feature()`, `story()`, `given()/when()/then()` - **xUnit** — class-based, `test*()` methods, `setup()`/`tearDown()` Both styles use the same assertions/expectations library and MockBox for mocking. --- ## Test Bundles A test bundle is a BoxLang class (`.bx` file) that contains your tests. Name files with `Test` or `Spec` suffix by convention: `UserServiceSpec.bx`, `OrderServiceTest.bx`. ```boxlang // tests/specs/UserServiceSpec.bx class extends="testbox.system.BaseSpec" { function run() { describe( "UserService", () => { it( "can greet a user", () => { expect( "hello" ).toBe( "hello" ) } ) } ) } } ``` Extending `testbox.system.BaseSpec` is optional but recommended: it enables IDE introspection, direct web runner execution, and faster test loading. ### Injected Variables (always available in bundles) | Variable | Purpose | |---|---| | `$mockbox` | MockBox instance for creating mocks | | `$assert` | Assertions library | | `$utility` | Utility helpers | | `$customMatchers` | Custom matcher registry | | `$testID` | Unique ID for the bundle | | `$debugBuffer` | Debug output buffer | --- ## BDD Style ### Basic Structure ```boxlang class extends="testbox.system.BaseSpec" { function run() { describe( "Calcu