Skip to content

Test Suite

The test suite automates document generation testing by sending requests to the Flask API and saving output files for review.

Prerequisites

  • Docker Desktop installed and running
  • Tests are pre-installed in the Docker image (no additional setup needed)

Running Tests

The test suite runs inside Docker, so you don’t need Python installed locally.

  1. Make sure Docker containers are running sh docker-compose up -d
  2. Run all basic tests docker-compose run --rm test
  3. Check generated files in tests/cases/*/output/

Run Specific Tests

Terminal window
# Run specific test by name
docker-compose run --rm test tests/ -v -k "page_break"
# Run by category
docker-compose run --rm test tests/ -v -k "row_formatting"
# Run with verbose output
docker-compose run --rm test tests/ -v -s

Full Test Suite (Including Large Documents)

By default, large document tests and other long running tests are skipped. To run the full test suite, including large document cases (which may take several minutes), use the dedicated command:

Terminal window
# Run ALL tests including large document tests
docker-compose run --rm test-full

Target Different Environments

By default, tests target the Docker app service. To test other environments:

Terminal window
# Target dev environment
docker-compose run --rm test tests/ -v --base-url https://dev.document-maker.com

Test Cases

CategoryTest CaseWhat it Tests
miscpage_break<PageBreak> tag
miscsplit_tablesSPLIT table functionality
miscgeneric_tableBasic table without formatting
miscgeneric_sheetsSpreadsheet-style tables
miscimage_testsImage insertion from assets.zip
misctoc_updateBasic TOC update
row_formattingdelete_row<deleterow> tag
row_formattingbackground_row<color background row>
cell_formattingbackground_cell<color background cell>
cell_formattingfont_cell<bold font cell>, <color font cell>
cell_formattingcell_row_combinedCombined cell + row formatting
text_formattingbold_underline<boldtext>, <underlinetext>
text_formattingcolor_text<colortext> tags
large_doctoc_large_documentLarge document TOC update (requires --full)

Test Case Structure

Each test case folder contains:

tests/cases/{category}/{test_name}/
├── template.docx # Word template (required)
├── data.json # Data to populate (required)
├── configuration.json # Request config (required)
├── assets.zip # Images/assets (optional)
└── output/ # Generated files (auto-created)

Adding New Test Cases

  1. Create folder in tests/cases/{category}/{test_name}/
  2. Add required files:
    • template.docx- Word template with Jinja2 tags
    • data.json - Sample data
    • configuration.json - Request configuration