Files
dagx/tests
swaits 5839b35979 test: add comprehensive testing infrastructure (fuzzing, proptest, mutation)
Implements dagx-11: Add comprehensive testing infrastructure including
fuzzing, property-based testing, and mutation testing configuration.

**Fuzzing Infrastructure:**
- Created fuzz/ directory with cargo-fuzz setup
- 4 fuzz targets covering different scenarios:
  - fuzz_dag_execution: Basic DAG execution with various patterns
  - fuzz_dependencies: Dependency management (linear, diamond, complex)
  - fuzz_type_safety: Type-safe output retrieval
  - fuzz_concurrent: Concurrent execution and thread safety
- Comprehensive README with usage instructions
- Integrated with justfile (fuzz, fuzz-all, fuzz-extended, fuzz-build)

**Property-Based Testing:**
- Added proptest dependency to Cargo.toml
- Created tests/property_tests.rs with 14 property tests:
  - Value preservation through DAG
  - Linear chain correctness
  - Fan-out pattern verification
  - Diamond pattern correctness
  - String, Vec, Option, Result handling
  - HashMap and custom struct preservation
  - DAG isolation
  - Concurrent execution scaling
- Integrated with justfile (proptest recipe)

**Mutation Testing:**
- Created .cargo-mutants.toml configuration
- Focused on critical functions:
  - DagRunner::run and ::get
  - TaskBuilder::depends_on
  - ExecutableNode::execute_with_listeners
  - ExtractFromListeners::extract
  - DepsTuple::to_node_ids
- Excluded low-value mutations (fmt, clone, default)
- Configured for nextest and parallel execution
- Already integrated via existing justfile mutants recipe

**Justfile Updates:**
- Added fuzzing section with 5 new recipes
- Added proptest recipe for property-based tests
- All recipes follow existing patterns and naming conventions

Similar setup to ../announcement project but tailored for DAG-specific testing.
2025-10-14 10:44:30 -06:00
..
2025-10-07 16:31:03 -07:00
2025-10-07 16:31:03 -07:00
2025-10-07 16:31:03 -07:00
2025-10-07 16:31:03 -07:00

Test Suite

Purpose

Integration and performance tests for dagx. Unit tests live in src/{module}/tests.rs.

Directory Structure

tests/
├── common/          # Shared test utilities
├── dependencies/    # Dependency resolution tests
├── execution/       # Task execution and DAG running
├── parallelism/     # Parallel execution verification
├── panic/           # Panic handling and isolation
├── performance/     # Stress tests and benchmarks
├── runtimes/        # Runtime compatibility tests
├── task_patterns/   # Common task pattern tests
├── type_safety/     # Type system validation
└── lib_tests.rs     # Main test entry point

Running Tests

# All tests (unit + integration)
cargo test

# Unit tests only
cargo test --lib

# Integration tests only
cargo test --test lib_tests

# Specific category
cargo test --test lib_tests -- parallelism::
cargo test --test lib_tests -- execution::

# With output
cargo test -- --nocapture

# Single threaded (for debugging)
cargo test -- --test-threads=1

# Performance tests (excluded by default)
cargo test --release -- --ignored

Test Categories

Unit Tests (src/{module}/tests.rs)

  • Module-specific logic
  • Edge cases and error conditions
  • Type implementations

Integration Tests (tests/)

  • execution: End-to-end DAG execution
  • dependencies: Complex dependency graphs
  • parallelism: Concurrent task execution
  • panic: Error propagation and isolation
  • performance: Large DAGs and stress tests
  • runtimes: Tokio, async-std, smol compatibility
  • task_patterns: Common usage patterns
  • type_safety: Type system guarantees

Writing Tests

Integration tests use common utilities from tests/common/mod.rs.

Unit tests should:

  • Test single units of functionality
  • Mock external dependencies
  • Cover error cases

Integration tests should:

  • Test component interactions
  • Use real implementations
  • Verify end-to-end behavior