Developer Guide
Testing & Benchmarks
How to run unit, integration, and doc tests using cargo-nextest and synthetic fixtures.
Black Sparrow follows strict Test-Driven Development (TDD). All 120 rules, URL normalization edge cases, and parser components are backed by automated tests.
Preferred Test Runner: cargo-nextest
We strongly recommend using cargo-nextest for running tests. It executes test cases in parallel with process isolation and clear terminal output:
Terminal
# Install cargo-nextest if not already installed
cargo install cargo-nextest --locked
# Run all workspace unit and integration tests
cargo nextest runIf nextest is not installed, standard cargo test works as a fallback:
Terminal
cargo testRunning Documentation Tests
nextest runs unit and integration tests. To execute doctests defined in src/ comments:
Terminal
cargo test --docTest Suites & Fixtures
The test suite is organized under tests/:
tests/url_normalization_test.rs: Validates RFC 3986 compliance, parameter stripping, and canonical resolution.tests/lol_html_parser_test.rs: Tests zero-copy HTML parsing on messy real-world markup.tests/crawler_engine_test.rs: Spins up local mock HTTP servers usingwiremockto test AIMD congestion, redirects, and robots.txt.tests/fixtures/: Contains synthetic HTML documents modeling edge cases (e.g. malformed JSON-LD, circular hreflang, missing H1 tags).
Running Specific Test Suites
To run only the SEO rule validation tests:
Terminal
cargo nextest run --test rules_testTo run a specific test by name:
Terminal
cargo nextest run test_canonical_loop_detection