Skip to content

Latest commit

 

History

History
76 lines (52 loc) · 2.3 KB

File metadata and controls

76 lines (52 loc) · 2.3 KB

Generating Expected Test Files

Overview

The test framework automatically generates expected output files when they don't exist. This is useful when adding new test data or creating new test classes.

Prerequisites

For PDF/XML tests, you need pdftohtml installed:

# Ubuntu/Debian
sudo apt install poppler-utils

# macOS
brew install poppler

# Windows
# Download from https://blog.alivate.com.au/poppler-windows/

Generating Expected Files for Sicoob Tests

To generate the missing XML expected files for the Sicoob tests:

# Run the Skippers tests (will auto-generate expected files)
python3 -m unittest tests.test_banco_sicoob.TestBancoSicoobSkippers

# Run the Vox tests (will auto-generate expected files)
python3 -m unittest tests.test_banco_sicoob.TestBancoSicoobVox

# Run all Sicoob tests to verify
python3 -m unittest tests.test_banco_sicoob

What Gets Generated

After running the tests, the following expected files will be created:

  • tests/html/BoletoSicoob-Skippers-expected.html ✓ (already committed)
  • tests/html/BoletoSicoob-Vox-expected.html ✓ (already committed)
  • tests/xml/BoletoSicoob-Skippers-expected.xml (will be auto-generated)
  • tests/xml/BoletoSicoob-Vox-expected.xml (will be auto-generated)
  • tests/xml/Triplo-BoletoSicoob-Skippers-expected.xml (will be auto-generated)
  • tests/xml/Triplo-BoletoSicoob-Vox-expected.xml (will be auto-generated)

How It Works

The testutils.py module has been updated to:

  1. Detect test class name suffixes (e.g., "Skippers", "Vox")
  2. Create separate expected files for each test class variant
  3. Maintain backward compatibility with existing tests

Naming Convention

  • Test class: TestBanco<BankName><Suffix>
  • Expected files: <BoletoClass>-<Suffix>-expected.<ext>

Example:

  • Test class: TestBancoSicoobSkippers
  • Boleto class: BoletoSicoob
  • Expected files: BoletoSicoob-Skippers-expected.html, BoletoSicoob-Skippers-expected.xml

Committing Expected Files

After generating the expected files, add them to git:

git add tests/xml/BoletoSicoob-Skippers-expected.xml
git add tests/xml/BoletoSicoob-Vox-expected.xml
git add tests/xml/Triplo-BoletoSicoob-Skippers-expected.xml
git add tests/xml/Triplo-BoletoSicoob-Vox-expected.xml
git commit -m "Add XML expected files for Sicoob real boleto tests"