CycloneDX / CycloneDX/cyclonedx-rust-cargo
Do round trip tests
- Dominant language
- Rust
- Stars
- 178
- Forks
- 66
- PR merge metrics
- No merged PRs in 30d
Description
The current test suite relies on `cargo-insta` to do snapshot testing but it also has serialized versions of several structs as `&'static str`s inside the codebase. But, nothing guarantees that the snapshot and the embedded strings actually match each other, doing visual inspection is not practical when the text is several hundred lines long. Even if they were the same, there is duplicated information due to this.
I consider that the embedded strings should be removed and only keep the snapshot files. I'm not sure if `cargo-insta` provides a way to read the snapshot files so they can be used as deserialization inputs so that's a thing to consider.
Additionally extra tests could be added to verify that serializing -> deserializing and deserializing -> serializing are consistent.
Contributor guide
Research direction
Start in the test suite and locate the structs with serialized &'static str values alongside their cargo-insta snapshots. Check whether cargo-insta can read snapshot files as deserialization inputs, then assess round-trip tests in both directions. Done means embedded strings are removed where snapshots can replace them and serialization/deserialization consistency is covered without duplicated fixtures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- testing-qa, tooling
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100