testbox-expectations

Write fluent TestBox assertions with chained matchers and expectAll().

1|Updated Apr 10, 2026
One-click install
npx skills add https://github.com/ColdBox/skills --skill testbox-expectations
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testbox-expectations
Source: https://github.com/ColdBox/skills/tree/main/testbox/expectations
Command: npx skills add https://github.com/ColdBox/skills --skill testbox-expectations

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Enables writing fluent assertions in TestBox using expect() and expectAll() across collections to improve test readability and maintainability.

Core Features & Use Cases

  • Fluent DSL for TestBox assertions with expect() and expectAll()
  • Chain multiple matchers on a single actual value
  • Use notToBe, notToBeEmpty, and related negations for negative tests
  • Create and register custom matchers with addMatchers()
  • Extensive set of built-in matchers (toBe, toBeTrue, toHaveKey, toThrow, toMatch, toBeBetween, toBeCloseTo, toInclude, etc.)

Quick Start

Start by using expect( actual ).toBeXxx() in tests and register custom matchers with addMatchers().

Frequently Asked Questions about testbox-expectations

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write fluent assertions in TestBox?

Fluent TestBox assertions are written by calling expect() on a value and chaining built-in matchers like toBe, toBeTrue, or toHaveKey directly to validate results. This chaining improves test readability and maintains a clean testing DSL.

How do I validate multiple items in a collection using TestBox?

You can validate multiple items in a collection using TestBox by applying expectAll() over arrays and structs. It enables bulk validation across collections to ensure all elements meet the expected matchers in unit tests.

Can I create custom matchers for TestBox assertions?

Yes, you can create and register custom matchers in TestBox using the addMatchers() function. This extensibility allows you to define and register specialized assertion logic tailored to your ColdBox project's specific testing requirements.

How do I perform negative assertions in TestBox unit tests?

Perform negative assertions in TestBox unit tests by using the not operator alongside built-in matchers, such as notToBe or notToBeEmpty. These negations allow you to verify that values do not meet specific conditions.

What built-in matchers are available for ColdBox unit tests?

Built-in matchers for ColdBox unit tests include toBe, toBeTrue, toHaveKey, toThrow, toMatch, toBeBetween, toBeCloseTo, and toInclude. They support validating values, collections, error handling, and edge cases across TestBox projects.

Does TestBox support chained matchers on a single value?

Yes, TestBox supports chaining multiple matchers on a single actual value using the fluent expect() DSL. This allows you to apply several assertions sequentially to thoroughly validate complex values and collections in unit tests.