Testing Files Generator
English

Generate real test files at any exact size

PDF, PNG, DOCX, ZIP - 30 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 Windows and macOS downloads are signed and start without a warning.

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.

Presets

Pick the question, get the whole set

A preset is a set of test files designed around one testing question, so you do not have to work out which files prove what. Each one has a page saying what it usually finds, what is in the set and every setting it takes.

All presets, and how they relate to recipes

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

What is signed, and what is not

The Windows and macOS downloads are signed, so they start without a warning about an unknown developer. The Linux ones are not, because desktop Linux has no equivalent to sign them with. Every archive is listed in verify-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 Windows and macOS downloads are signed and start without a warning.