testbox-assertions

Provide xUnit-style assertion helpers for TestBox $assert objects.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provide clear, consistent, and comprehensive guidance for writing xUnit-style assertions with the TestBox $assert object so developers can reliably validate expectations, reduce test errors, and standardize assertion patterns across test suites.

Core Features & Use Cases

  • Comprehensive Assertion Reference: Covers boolean, equality, null/empty, size/length, key existence, inclusion, type checks, numeric comparisons, regex/string matching, exception assertions, and forced pass/fail/skip.
  • Custom Assertions: Shows how to register inline or class-based assertion libraries with addAssertions for reusable, domain-specific checks.
  • BoxLang Convenience Methods: Documents dynamic assertXxx() method usage in BoxLang for concise tests.
  • Use Case: Validate API responses by asserting structure, required keys, types, and expected values, and register shared helpers for complex domain validations.

Quick Start

Write an xUnit test that uses $assert.isEqual to compare expected and actual values and register reusable assertions via addAssertions in beforeTests.

Frequently Asked Questions about testbox-assertions

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

FAQPage Schema
How do I write xUnit assertions in TestBox to validate expected values?

Use the TestBox $assert object in your unit test functions to perform xUnit assertions like isEqual, checking expected against actual values to validate test expectations reliably across your test suite.

How do I register custom assertions in TestBox for domain-specific checks?

Register custom assertions in TestBox by using the addAssertions method to load inline or class-based assertion libraries, enabling reusable domain-specific validation logic for complex test scenarios.

What types of assertion checks are available with the TestBox $assert object?

The TestBox $assert object provides comprehensive assertion checks for equality, boolean states, type matching, null and empty states, size and length, key existence, inclusion, numeric comparisons, regex, and exceptions.

Can I use dynamic assertion methods with BoxLang in my TestBox BDD specs?

Yes, BoxLang supports dynamic assertXxx() convenience methods for concise testing, allowing you to apply assertion workflows directly within TestBox BDD it() blocks for validating expectations.

How do I assert that an API response contains required keys and correct types in TestBox?

Validate API responses in TestBox by using $assert assertions to verify data structure, required key existence, value types, and expected values, ensuring the response matches your contract.

Does TestBox support forced pass, fail, and skip assertions for test flow control?

Yes, TestBox provides forced pass, fail, and skip assertion methods, allowing you to explicitly control test execution flow and handle edge cases within your xUnit and BDD testing workflows.