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 folder (trailing / ensures exact folder match)
docker-compose run --rm test tests/ -v -k "tables/"
# 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
miscimage_testsImage insertion from assets.zip
miscstring_formattingString formatting
miscticksTick/checkbox rendering
misctoc_updateBasic TOC update
misctoc_update_advancedAdvanced TOC update
tablesbackground_cell<color background cell>
tablesbackground_row<color background row>
tablescell_row_combinedCombined cell + row formatting
tablesdelete_row<deleterow> tag
tablesfont_cell<bold font cell>, <color font cell>
tablesfont_size_cellFont size in cells
tablesgeneric_tableBasic table without formatting
tablessplit_tablesSPLIT table functionality
tablestable_no_data_replacementTable with no data replacement
sheetsgeneric_sheetsBasic sheets without 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), and configuration.json (request configuration).