Skip to content

Testing

CodingJeffRoblox edited this page Sep 23, 2026 · 1 revision

Testing

cd tests
python -m unittest test_signatures test_text_recovery test_scanner test_filesystem test_gui_recovery_center -v

What the suite covers

The suite (tests/, 55 tests) runs entirely against synthetic fixtures built in memory (tests/fixtures.py) — a JPEG with an embedded EXIF thumbnail, a multi-revision PDF, a multi-entry ZIP, a minimal but structurally real PE and ELF binary, an MP4 box tree, hand-built byte-exact FAT16 and FAT32 volume images, ASCII/UTF-8/UTF-16 text samples, and more — never real files or real drives.

It covers:

  • Carving correctness (including the JPEG-thumbnail and multi-entry-ZIP edge cases)
  • Text-encoding detection
  • False-positive rejection
  • Chunk-boundary-split signatures
  • Duplicate detection
  • Cancellation
  • Destination-safety checks
  • Device-path handling — a regression test for the pathlib bug where \\.\PhysicalDrive2 was silently mangled into \\.\PhysicalDrive2\, breaking raw-drive scans (see the Changelog's 0.3.0 entry)
  • FAT12/16/32 directory parsing (deleted files, multi-cluster chains, subdirectories, long filenames)
  • SHA-256
  • test_gui_recovery_center.py — real Tkinter widgets, needs a display — verifies the Recovery Results table survives a malformed result item without silently losing every row after it (see the Changelog's 0.6.0 entry), plus regression tests for the 0.6.1 "scan can run twice" bug and the 0.7.0 GUI-thread blocking bug

Why GUI logic is tested too

Two of the more serious bugs found in this project so far were pure GUI-callback bugs (a dead button after the first scan, and a multi-second UI freeze from a synchronous WMI call on the GUI thread) that unit tests on the recovery engine alone would never catch. test_gui_recovery_center.py drives real Tkinter widgets against a shared root window (see the 0.6.1 changelog entry for why it's a shared root) to catch this class of bug directly.

See Project Structure for how the engine and GUI are split, and Changelog for the bugs these tests were written to catch.

Clone this wiki locally