Back to docs

Tool Assert

Category: Testing · Tier: All

Assert a condition using natural language. Text comparisons ignore case unless caseSensitive is true.

When to Use

Testing tools generate and validate test cases in natural language. They also detect unreliable tests and map coverage.

Parameters

Parameter Type Required Default Description
assertion string Yes - Natural language assertion like "page contains 'Welcome'" or "title is 'Home'"
caseSensitive boolean No false Compare text exactly, case included. With the default, "page contains 'welcome'" matches "Welcome"
_browserToken string No - Browser session token from a previous call

The default matches the CLI's cbrowser assert. Steps in natural-language test suites (nl_test_inline, nl_test_file) compare exactly unless fuzzyMatch is set.

Example

Verify that the page title contains "Dashboard"
Check the exact heading text,
case included
→ assertion:
    "page contains 'Sign In'",
  caseSensitive: true

Tips

  • Natural language tests need no code -- just describe what to verify
  • Save tests to files and run them in CI/CD pipelines

Research

  • Hick-Hyman Law — Decision time = a + b × logâ‚‚(n) for n choices

From the Blog