Skip to content

Testing

Rust Tests

Terminal window
cargo test

Python Tests

Terminal window
pytest

Run Specific Tests

Terminal window
cargo test test_snapshot_creation
pytest tests/test_capture.py -k "test_basic"

Writing Tests

Rust

#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_snapshot_creation() {
let snapshot = DecisionSnapshot::new(input, output, params);
assert!(snapshot.id().len() > 0);
}
}

Python

from briefcase import capture, DecisionSnapshot
def test_capture_creates_snapshot():
@capture()
def my_fn(x):
return x * 2
result = my_fn(5)
assert result == 10

Coverage

Terminal window
cargo tarpaulin --out html
pytest --cov=briefcase --cov-report=html