Testing Files Generator

Generate real test files at any exact size

PDF, PNG, DOCX, ZIP - 20 formats in all, and every one is a real file that opens in the software that owns it, at exactly the size you asked for. Each run also writes down what your application is supposed to do with each file. Command line and desktop window, free and open source, working entirely on your machine.

Free and open source, GPL-3.0. Nothing to sign up for. The binaries are not signed yet, so your system will warn you the first time - the release notes say what to expect.

The desktop window of Testing Files Generator, set up to write a batch of test files
The desktop window, set up to write a batch of files. The same engine runs behind the command line.

The problem

Making one test file is easy. Making the right thousand is the tedious part

You are testing software that accepts files from people. Sooner or later you need:

That is what this replaces. It is built for QA engineers, test automation, and anyone whose code has an upload form, an import routine, a parser or a storage quota behind it.

What makes it different

Other generators stop at the bytes. This one answers what your test actually asks

A folder of files still leaves you deciding what each one is supposed to prove. Every run here writes a manifest.json beside the files - a plain list of everything produced, and for each entry a declared expectation.

Say your upload endpoint allows 1 MB. Ask for the three files that sit on that line:

tfg generate --preset size-boundaries --limit 1mb --spread 1B --format pdf --out ./edges
FileBytesYour system shouldBecause
1mb_under_1b.pdf1048575accept itit is inside the limit
1mb_at_limit.pdf1048576accept itthe limit itself is allowed
1mb_over_1b.pdf1048577reject itsize_limit

Three files, three different answers, in machine readable form. Your test reads the manifest instead of you hand writing the assertions:

import json, os

directory = "edges"
manifest = json.load(open(os.path.join(directory, "manifest.json")))

for entry in manifest["files"]:
    response = upload(os.path.join(directory, entry["path"]))
    outcome = entry["expected"]["outcome"]
    if outcome == "accept":
        assert response.ok, entry["path"]
    elif outcome == "reject":
        assert not response.ok, entry["path"]

Where the answer depends on your own policy, the manifest says so

It records unspecified rather than inventing an expectation. A generator that guesses produces false failures, and a suite that cries wolf gets switched off.

Quick start

Three commands to see it working

  1. Make a file

    One PNG, exactly two megabytes:

    tfg generate --format png --size 2mb --out ./fixtures
  2. Make a lot of files

    Ten thousand log files, each between one and eight kilobytes, with the sizes drawn from the seed so tomorrow gives the same set. Give each run its own directory - the manifest is the only record of what a run wrote, so the tool refuses to write a second one over it:

    tfg generate --format log --size-range 1kb-8kb --count 10000 --out ./logs
  3. Check them, then remove them

    verify tells you nothing moved. cleanup removes exactly what was written and nothing else:

    tfg verify ./logs/manifest.json
    tfg cleanup ./logs/manifest.json --yes

Sizes count in 1024s, the way your file manager does, so 2mb means 2097152 bytes. A plain byte count works too. The documentation covers recipes, the manifest and the exit codes.

What you get

Built for a suite that runs unattended

Download

Pick the build for your system

Unpack the archive and run it. tfg is the command line and tfg-gui is the desktop window. There is no installer and nothing to add to your machine.

System Command line Desktop window
Windows amd64, arm64 amd64
Linux amd64, arm64 amd64
macOS arm64 arm64

The binaries are not signed

Your system will warn you the first time you run one. The release notes say exactly what each system shows and why. Every archive is listed in SHA256SUMS.txt on the release page, so you can check what you downloaded.

Free and open source, GPL-3.0. Nothing to sign up for. The binaries are not signed yet, so your system will warn you the first time - the release notes say what to expect.

Honest scope

Where this is today

Version 0.1.0. A tool that oversells itself wastes your afternoon, so here is the state of it.

Working end to end: 20 formats, recipes, presets, the desktop window, generate, validate, verify, cleanup, boundary sets, archive contents, size ranges, per format settings, manifests and every exit code.

Not there yet: five more formats are planned - 7z, tiff, webp, mp3 and mp4. The preset catalogue has one entry so far. Some recipe keys are recognised and refused with a message saying they are not built yet, rather than being ignored quietly. The binaries are not signed.

Found a problem or want a format? The issue tracker is open, and so is the discussion about what gets built next.