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.
- Make sure Docker containers are running
sh docker-compose up -d - Run all basic tests
docker-compose run --rm test - Check generated files in
tests/cases/*/output/
Run Specific Tests
# Run specific test by namedocker-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 outputdocker-compose run --rm test tests/ -v -sFull 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:
# Run ALL tests including large document testsdocker-compose run --rm test-fullTarget Different Environments
By default, tests target the Docker app service. To test other environments:
# Target dev environmentdocker-compose run --rm test tests/ -v --base-url https://dev.document-maker.comTest Cases
| Category | Test Case | What it Tests |
|---|---|---|
| misc | page_break | <PageBreak> tag |
| misc | image_tests | Image insertion from assets.zip |
| misc | string_formatting | String formatting |
| misc | ticks | Tick/checkbox rendering |
| misc | toc_update | Basic TOC update |
| misc | toc_update_advanced | Advanced TOC update |
| tables | background_cell | <color background cell> |
| tables | background_row | <color background row> |
| tables | cell_row_combined | Combined cell + row formatting |
| tables | delete_row | <deleterow> tag |
| tables | font_cell | <bold font cell>, <color font cell> |
| tables | font_size_cell | Font size in cells |
| tables | generic_table | Basic table without formatting |
| tables | split_tables | SPLIT table functionality |
| tables | table_no_data_replacement | Table with no data replacement |
| sheets | generic_sheets | Basic sheets without formatting |
| text_formatting | bold_underline | <boldtext>, <underlinetext> |
| text_formatting | color_text | <colortext> tags |
| large_doc | toc_large_document | Large 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
- Create folder in
tests/cases/{category}/{test_name}/ - Add required files:
template.docx(Word template with Jinja2 tags),data.json(sample data), andconfiguration.json(request configuration).