skillZs
★ LIVE SKILL TAGS ★
>>> LIVE SKILLS INDEX <<<
* OPEN SOURCE *
NO LOGIN, NO TRACKING
※ REAL INSTALL DATA ※
← back to all skills
pproenca/dot-skills93 installs

rust-testing

Rust testing best practices covering test architecture, assertions, mocking, snapshots, event testing, determinism, and integration patterns for the codex-rs codebase

How do I install this agent skill?

npx skills add https://github.com/pproenca/dot-skills --skill rust-testing
view source ↗

Is this agent skill safe to install?

  • Gen Agent Trust Hubpass

    The skill is a comprehensive collection of best practices and reference materials for Rust testing. It is purely informational and contains no executable code or malicious patterns.

  • Socketpass

    No alerts

  • Snykpass

    Risk: LOW · No issues

  • Runlayerwarn

    48/48 files flagged

What does this agent skill do?

Codex-RS Contributors Rust Testing Best Practices

A comprehensive guide to writing high-quality Rust tests at the standard established by the top codex-rs contributors. This skill encodes patterns for test architecture, assertions, mock servers, test data, event-driven testing, determinism, snapshot testing, and integration test infrastructure.

When to Apply

  • Writing new tests for any Rust module in codex-rs
  • Adding regression tests for a bug fix (3-6 tests per PR)
  • Creating integration tests that interact with the Responses API via SSE mocks
  • Modifying TUI rendering code that requires snapshot coverage
  • Reviewing test code for adherence to codebase conventions

Rule Categories by Priority

PriorityCategoryPrefixRulesFocus
CRITICALTest Architecturearch-6File organization, imports, isolation
CRITICALAssertionsassert-5pretty_assertions, whole-object comparison
HIGHMock Serversmock-6wiremock, SSE builders, ResponseMock
HIGHTest Datadata-5Builders, typed construction, BTreeMap
MEDIUM-HIGHEvent Testingevent-5submit/wait cycles, predicate matching
MEDIUMDeterminismdet-5Stable IDs, environment isolation
MEDIUMSnapshot Testingsnap-4Insta workflow, buffer rendering
LOW-MEDIUMIntegration Testsinteg-4core_test_support, Bazel compatibility

Quick Reference

  • Test file placement: Sibling _tests.rs via #[path = "feature_tests.rs"]
  • Assertions: Always use pretty_assertions::assert_eq;
  • Object comparison: assert_eq!(actual, expected) on entire structs
  • SSE mocking: responses::mount_sse_once + responses::sse(vec![ev_*(...)])
  • Event waiting: wait_for_event(codex, |ev| predicate)
  • Snapshot tests: insta::assert_snapshot!(terminal.backend())
  • Determinism: BTreeMap over HashMap, set_deterministic_process_ids
  • Binary resolution: codex_utils_cargo_bin::cargo_bin("name")
  • Fixture paths: codex_utils_cargo_bin::find_resource!("path")
  • Sandbox handling: skip_if_sandbox!() / skip_if_no_network!()

How to Use

  1. Start with CRITICAL rules (arch, assert) — these apply to every test
  2. Apply HIGH rules (mock, data) when writing integration tests with API mocks
  3. Apply MEDIUM-HIGH rules (event) when testing the agent protocol
  4. Apply MEDIUM rules (det, snap) when tests involve process IDs or UI rendering
  5. Apply LOW-MEDIUM rules (integ) for cross-crate and build-system compatibility

Reference Files

FilePurpose
references/_sections.mdSection definitions, ordering, and impact levels
references/arch-*.mdTest architecture rules (6 files)
references/assert-*.mdAssertion rules (5 files)
references/mock-*.mdMock server rules (6 files)
references/data-*.mdTest data rules (5 files)
references/event-*.mdEvent testing rules (5 files)
references/det-*.mdDeterminism rules (5 files)
references/snap-*.mdSnapshot testing rules (4 files)
references/integ-*.mdIntegration test rules (4 files)
assets/templates/_template.mdRule file template
metadata.jsonSkill metadata and version

Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.

<a href="https://skillzs.dev/skills/pproenca/dot-skills/rust-testing">View rust-testing on skillZs</a>