intermediate6 min readSeptember 21, 2025

FileMock Testing Scenarios & File Checklists

FileMock Testing Scenarios & File Checklists

Use these checklists to plan the test files for common upload features. Each list has two parts:

  • Generate: files you create in FileMock by choosing a format, size and (for images and video) resolution.
  • Derive: edge cases you make from those files with one shell command, such as empty, renamed or truncated files.

FileMock creates valid files only. That's intentional: starting from a known-good file means every derived edge case changes exactly one thing.

Before You Start: Sizes and Units

FileMock sizes are binary megabytes (1 MB = 1,048,576 bytes). Many backends define limits in decimal megabytes (1 MB = 1,000,000 bytes). For boundary tests, always check the real byte count:

wc -c < my-test-file.jpg

The Derive Commands

These commands work on macOS and Linux and are used throughout the checklists:

: > empty.jpg                               # empty file (0 bytes)
cp image.png wrong-content.jpg              # real PNG content, .jpg name
cp document.pdf report.pdf.txt              # double extension
cp document.pdf no-extension                # no extension
head -c 4096 image.jpg > truncated.jpg      # cut-off, unreadable file
cp file.pdf plus-one.pdf && printf 'x' >> plus-one.pdf   # exactly 1 byte larger

Scenario 1: E-commerce Product Images

Typical rules: JPG, PNG or WebP; up to 10 MB; at least 500 × 500 pixels.

Generate (Image tab):

FileFormatResolutionSize
Phone-sized photoJPG640 × 6401 MB
Detailed photoPNG1920 × 10805 MB
Modern formatWebP720 × 7201 MB
Resolution floorJPG500 × 5001 MB
Below the floorJPG499 × 4991 MB
Just under the limitJPG4K9.9 MB
Just over the limitJPG4K10.1 MB
Unsupported formatTIFFFull HD5 MB
PanoramaJPG4000 × 5005 MB

If an image at the chosen settings would be larger than the target size, FileMock lowers the quality and then the resolution until it fits, and shows the final resolution after the download. The sizes above leave enough room for the listed dimensions.

Derive: an empty .jpg, PNG content with a .jpg name, and a truncated JPG.

Check: correct accept/reject at each boundary, readable error messages, thumbnails cropped sensibly for the panorama.

Scenario 2: Document Management

Typical rules: PDF, DOCX, XLSX and TXT; up to 25 MB.

Generate (Document tab):

  • PDF at 0.1 MB, 5 MB, 24.9 MB and 25.1 MB
  • DOCX and XLSX at 1 MB
  • TXT at 100 KB
  • RTF, HTML and ZIP at 1 MB, as formats that should be rejected
  • CSV and JSON at 1 MB, if your import feature accepts data files

Derive: an empty PDF, DOCX content with a .pdf name, a double-extension file, and a file exactly one byte over the limit.

Check: content-based type detection on the server, preview generation for each accepted format, and no leftover files after rejected uploads.

Scenario 3: Social Media Posts

Typical rules: square, portrait and story images; short videos with a duration and size limit.

Generate:

  • Images: JPG at 5 MB in Instagram (1080 × 1080) and 1080 × 1920 (custom, story format), and 400 × 400 at 1 MB (avatar)
  • Animated images: animated GIF and animated WebP at 2 MB
  • Video (Video tab): MP4 at 15 seconds / 5 MB and 60 seconds / 25 MB, plus vertical 1080p
  • Video formats users send: MOV (the format iPhones record in) and WebM (browser recordings)
  • EXIF: JPG files with each orientation value, to check that photos display upright

Derive: a truncated MP4 (head -c 1048576 video.mp4 > broken.mp4) to check that the transcoding pipeline fails cleanly.

Check: correct aspect-ratio handling, transcoding of MOV and WebM, orientation applied, and EXIF removed from public copies if your privacy policy says so.

Scenario 4: Audio Uploads

Typical rules: MP3, WAV or M4A; up to 10 minutes; up to 100 MB.

Generate (Audio tab):

  • MP3, WAV and M4A at 30 seconds
  • A 9:59 (599 seconds) and a 10:01 (601 seconds) MP3, to test the duration limit
  • Mono and stereo versions
  • 44.1 kHz and 48 kHz sample rates, and 16-bit and 24-bit WAV
  • OGG and WebM audio, as formats that may or may not be accepted

Compressed files keep the duration you enter as long as the target size allows it. WAV is uncompressed: a 10-minute 44.1 kHz stereo 16-bit WAV needs about 101 MB, so for long WAV tests use a large enough target size or a lower sample rate.

Check: duration is read correctly, the player and waveform preview work, and over-length files get a clear message.

Scenario 5: Performance and Limits

Generate:

  • One file each at 1 MB, 10 MB, 100 MB, 500 MB and 1,000 MB (PDF or MP4 work well)
  • 20 separate 1 MB images for concurrent upload tests

Check:

  • Upload time grows roughly in line with file size
  • Memory use on the server stays flat while large files stream to storage
  • Concurrent uploads don't slow down unrelated requests
  • Timeouts are long enough for the largest allowed file on a slow connection

A simple concurrency test with real files:

import fs from "fs";

const files = Array.from({ length: 20 }, (_, i) =>
  fs.readFileSync(`fixtures/load/image-1mb-${String(i + 1).padStart(2, "0")}.jpg`)
);

const start = performance.now();
const results = await Promise.all(
  files.map((buffer, i) => {
    const form = new FormData();
    form.append("file", new Blob([buffer], { type: "image/jpeg" }), `image-${i + 1}.jpg`);
    return fetch("https://staging.example.com/api/upload", { method: "POST", body: form });
  })
);

console.log(`20 uploads in ${Math.round(performance.now() - start)} ms`);
console.log(results.map((r) => r.status));

Scenario 6: Upload Security Basics

These checks use the clean files from the scenarios above. For a full walkthrough, see the security testing case study.

  • PNG content with a .jpg name and HTML content with a .jpg name: must not be trusted or rendered as HTML
  • A file sent with a manually changed Content-Type header
  • Names such as ../../file.pdf and <b>name</b>.pdf: must be stored under a generated name and escaped when displayed
  • A file just over the size limit sent directly to the API, bypassing the UI

Only run these against systems you own or are authorized to test.

Organizing the Files

tests/fixtures/ ├── images/ ├── documents/ ├── audio/ ├── video/ ├── derived/ # empty, renamed, truncated └── load/ # large and bulk files, not committed to git

Name files after what they test (pdf-25.1mb-over-limit.pdf) so failing tests are self-explanatory.


Generate the files for these checklists with FileMock. Everything is created in your browser; nothing is uploaded.

Related Resources

Apply This Knowledge

Put this resource into practice with FileMock. Generate the exact test files you need and implement robust testing strategies.

Try FileMock Now