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 categorydocker-compose run --rm test tests/ -v -k "row_formatting"
# 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 | split_tables | SPLIT table functionality |
| misc | generic_table | Basic table without formatting |
| misc | generic_sheets | Spreadsheet-style tables |
| misc | image_tests | Image insertion from assets.zip |
| misc | toc_update | Basic TOC update |
| row_formatting | delete_row | <deleterow> tag |
| row_formatting | background_row | <color background row> |
| cell_formatting | background_cell | <color background cell> |
| cell_formatting | font_cell | <bold font cell>, <color font cell> |
| cell_formatting | cell_row_combined | Combined cell + row 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 tagsdata.json- Sample dataconfiguration.json- Request configuration