beginner5 min readSeptember 18, 2025

FileMock Quick Start Guide

FileMock Quick Start Guide

FileMock is a web application that generates test files for your development and testing needs. This quick start guide gets you up and running in 5 minutes.

What is FileMock?

FileMock generates realistic test files directly in your browser - completely client-side with instant file generation for comprehensive testing.

Perfect for:

  • Unit test fixtures
  • E2E testing scenarios
  • Performance testing with large files
  • Edge case validation
  • Upload validation and security checks

Step 1: Access FileMock

  1. Visit filemock.com
  2. No signup required - start generating files immediately
  3. 100% client-side - your data never leaves your browser

Step 2: Generate Your First Test File

Basic Image Generation

  1. Select file type: Choose the "Image" tab
  2. Set properties:
    • Format: JPG/JPEG
    • Target file size: 0.5 MB (good for basic testing)
    • Resolution: keep the default (Full HD); if the image would be larger than the target size, FileMock lowers the quality and then the resolution until it fits
  3. Click the Generate button
  4. The file is downloaded automatically when it's ready; move it into your project

Sizes are entered in megabytes, and FileMock uses binary megabytes: 0.5 MB = 524,288 bytes.

Advanced Options

FileMock offers powerful customization:

File Size Options: ├── Tiny (1KB - 10KB) - Icon testing ├── Small (10KB - 100KB) - Thumbnail testing ├── Medium (100KB - 1MB) - Standard uploads ├── Large (1MB - 10MB) - Performance testing └── Huge (10MB+) - Stress testing

Step 3: Organize Your Test Files

Recommended Folder Structure

your-project/
├── tests/
│   └── fixtures/
│       └── filemock-files/
│           ├── images/
│           │   ├── valid-small.jpg
│           │   ├── valid-large.png
│           │   └── truncated.jpg
│           ├── documents/
│           │   ├── small-pdf.pdf
│           │   └── large-docx.docx
│           └── edge-cases/
│               ├── empty-file.txt
│               ├── oversized.jpg
│               └── wrong-extension.pdf

File Naming Convention

Use descriptive names that indicate purpose:

# Good naming examples
filemock-valid-jpeg-500kb.jpg
filemock-oversized-image-15mb.png
filemock-truncated-jpeg-4kb.jpg
filemock-wrong-extension.pdf

# Include in filename:
- filemock- prefix (identifies source)
- purpose (valid/invalid/oversized)
- format (jpeg/png/pdf)
- size (500kb/15mb)

Step 4: Integration Examples

Jest Integration

// tests/fileUpload.test.js
import fs from "fs";
import path from "path";

const loadFileMockFile = (filename) => {
  const filePath = path.join(__dirname, "fixtures/filemock-files", filename);
  const buffer = fs.readFileSync(filePath);
  return new File([buffer], filename, { type: "image/jpeg" });
};

test("handles FileMock generated files", () => {
  const testFile = loadFileMockFile("filemock-valid-jpeg-500kb.jpg");
  expect(testFile.size).toBe(524288); // 0.5 MB in FileMock = 524,288 bytes
  expect(testFile.type).toBe("image/jpeg");
});

Cypress Integration

// cypress/e2e/fileUpload.cy.js
describe("File Upload with FileMock", () => {
  it("uploads FileMock generated file", () => {
    cy.visit("/upload");

    // Use FileMock generated file
    cy.get('[data-testid="file-input"]').selectFile("cypress/fixtures/filemock-files/filemock-valid-jpeg-500kb.jpg");

    cy.get('[data-testid="upload-button"]').click();
    cy.contains("Upload successful").should("be.visible");
  });
});

Step 5: Testing Scenarios with FileMock

Comprehensive Test Suite

Generate files for different scenarios:

1. Happy Path Testing

# Generate standard files
- 100KB JPEG image
- 2MB PNG image
- 500KB PDF document

2. Edge Case Testing

# Generate boundary cases
- 1KB minimum file (0.001 MB)
- A file just under your size limit
- A file just over your size limit

3. Error Scenario Testing

FileMock generates valid files. Derive the broken ones from them with standard commands:

: > empty.txt                                   # empty file (0 bytes)
head -c 4096 valid.jpg > truncated.jpg          # cut-off, unreadable image
cp valid.pdf wrong-extension.jpg                # PDF content with a .jpg name

4. Performance Testing

# Generate load testing files
- 50MB large image
- 100MB video file
- Multiple 5MB files

Pro Tips

Batch Generation Workflow

  1. Plan your test scenarios first
  2. Generate all files in one FileMock session
  3. Download and organize immediately
  4. Document file purposes in your test comments

File Management

// Create a FileMock file registry
const FILEMOCK_FILES = {
  validImage: "filemock-valid-jpeg-500kb.jpg",
  largeImage: "filemock-large-png-5mb.png",
  invalidFile: "filemock-truncated-image.jpg",
  oversizedFile: "filemock-oversized-15mb.jpg",
};

// Use in tests
const testFile = loadFileMockFile(FILEMOCK_FILES.validImage);

Version Control

# Include FileMock files in git for team consistency
git add tests/fixtures/filemock-files/
git commit -m "Add FileMock test files for upload testing"

Next Steps

  1. Explore Advanced Features: Try different file formats and sizes
  2. Build Test Suites: Create comprehensive test scenarios
  3. Team Integration: Share FileMock files with your team
  4. Automate: Commit small fixture files so your CI/CD pipeline uses the same files as your team

Common Use Cases

Frontend Testing

  • Upload component validation
  • File preview functionality
  • Drag & drop interactions
  • Progress indicator testing

Backend Testing

  • File processing endpoints
  • Storage integration
  • File validation logic
  • Performance under load

Security Testing

  • Content-based file type detection
  • File type validation
  • Size limit enforcement
  • Content scanning

FileMock makes it easy to test all these scenarios with realistic, consistent test data generated instantly in your browser.

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