Instead of writing specific test cases, you define properties that must hold for all inputs, and proptest generates thousands of random inputs to try to falsify them.

use proptest::prelude::*;

proptest! {
    #[test]
    fn can_frame_roundtrip(
        id in 0u32..0x7FF,        // 11-bit arbitration ID
        data in prop::collection::vec(any::<u8>(), 0..=8)
    ) {
        let frame = CanFrame::new(id, &data).unwrap();
        let encoded = frame.encode();
        let decoded = CanFrame::decode(&encoded).unwrap();
        
        prop_assert_eq!(decoded.id(), id);
        prop_assert_eq!(decoded.data(), data.as_slice());
    }
}

When proptest finds a failing case, it shrinks it: it tries smaller and simpler inputs until it finds the minimal reproducer. A failing id of 0x3F7 might shrink to 0x1 if the actual bug only depends on a single bit being set.

Used in SpaceCAN for protocol roundtrip testing and in Cerberus-OS for scheduler property tests (highest priority task always runs, priority inheritance always resolves inversion).

The connection to formal verification: property-based testing is not proof, but it's the practical step between unit tests and full formal verification. VeraCAN will use proptest alongside Kani — the properties defined for proptest become the specifications proved by Kani.