Running Tests¶
Test suite and testing practices for bindcar.
Run All Tests¶
Test Types¶
Unit Tests¶
Test individual functions and modules:
Located in:
- src/auth.rs - Authentication tests
- src/zones.rs - Zone configuration tests
- src/rndc.rs - RNDC executor tests
Integration Tests¶
Test API endpoints and workflows:
Located in tests/ directory.
Running Specific Tests¶
By Name¶
By Module¶
With Output¶
Test Coverage¶
Currently no coverage tooling configured. Future improvement.
Writing Tests¶
Unit Test Example¶
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_zone_config_validation() {
let config = ZoneConfig {
ttl: 3600,
// ...
};
assert!(config.is_valid());
}
}
Integration Test Example¶
#[tokio::test]
async fn test_create_zone() {
let app = create_test_app().await;
let response = app
.post("/api/v1/zones")
.json(&zone_request)
.send()
.await;
assert_eq!(response.status(), StatusCode::CREATED);
}
Continuous Integration¶
Tests run automatically on: - Pull requests - Pushes to main branch
See .github/workflows/pr.yml.
Next Steps¶
- Development Setup - Development environment
- Contributing - Contribution guidelines