mirror of
https://github.com/bahdotsh/wrkflw.git
synced 2025-12-16 11:47:45 +01:00
Testing Strategy
This directory contains integration tests for the wrkflw project. We follow the Rust testing best practices by organizing tests as follows:
Test Organization
- Unit Tests: Located alongside the source files in
src/using#[cfg(test)]modules - Integration Tests: Located directly in this
tests/directorymatrix_test.rs- Tests for matrix expansion functionalityreusable_workflow_test.rs- Tests for reusable workflow validation
- End-to-End Tests: Also located in this
tests/directorycleanup_test.rs- Tests for cleanup functionality with Docker resources
Running Tests
To run all tests:
cargo test
To run only unit tests:
cargo test --lib
To run only integration tests:
cargo test --test matrix_test --test reusable_workflow_test
To run only end-to-end tests:
cargo test --test cleanup_test
To run a specific test:
cargo test test_name
Writing Tests
Please follow these guidelines when writing tests:
- Use meaningful test names that describe what is being tested
- Group related tests together in modules
- Use helper functions to reduce duplication
- Test both success and failure cases
- Use
#[should_panic]for tests that expect a panic - Avoid test interdependencies