Repository navigation
Testing
How to run ZeRechnung's tests, from the quick local run to the full conformance suite against the official artefacts.
go test ./...The base tests need nothing but the repository. CI (ci.yml) runs them with -race on Go 1.24 and on the latest Go release, after gofmt and go vet.
The fuzz targets (PDF reader, Flate codec, XML reader, BT-24 lookup in the attachment) run in CI on their seed corpus only, like any test. Fuzzing itself takes too long for CI and is started by hand:
go test -run '^$' -fuzz '^FuzzOpen$' -fuzztime 30s ./internal/pdfThe same goes for FuzzInflate and FuzzDeflate in internal/pdf, FuzzParse in internal/xmltree, and FuzzSpecificationID at the root.
More tests turn on when the official artefacts are available. CI already runs those for the Dutch rules (FX_NL, FX_NL_TESTS), whose artefacts conformance/fetch-nl.sh downloads in a few seconds.
The Conformance workflow fetches all of them at pinned versions (a commit for repositories, a SHA-256 for files) and runs them on every pull request. It fails if any of them is skipped.
Locally, this command fetches the same artefacts and sets the variables (see conformance/README.md, in French):
eval "$(conformance/fetch.sh)"| Variable | Content | Tests |
|---|---|---|
FX_CORPUS |
Clone of ZUGFeRD/corpus | Extraction and check of the corpus PDFs; reading, round trip, UBL 2.1 schema and validation of the UBL invoices in XML-Rechnung/UBL
|
FX_CORPUS_XML |
XML extracted from the corpus | Reading, validation and read-then-write round trip: with no loss reported, the whole tree of the original document must be found in the rewritten XML, in its profile and in EXTENDED. A ZUGFeRD 1.0 XML (extracted from a PDF of ZUGFeRDv1) is compared with its CII D16B view |
FX_XSD |
Factur-X 1.09.2 XSD, one folder per profile (MINIMUM, BASICWL, BASIC, EN16931, EXTENDED) |
The XML written by cii.Marshal is checked against the original XSDs |
FX_XSD_DIR |
Factur-X 1.09.2 XSD: FeRD ZUGFeRD 2.5.2 package (BASIC, EN 16931, EXTENDED) and FNFE-MPE 1.09 package (MINIMUM, BASIC WL, unchanged by corrigendum 1.09.2) | The regenerated schema tables are identical to those in the repository |
FX_KOSIT |
Clone of itplr-kosit/xrechnung-testsuite | Every CII and UBL invoice of the KoSIT test suite passes the BR-DE rules; its CII invoices respect the CII D16B schema; its UBL invoices are also read, written back, checked against the UBL 2.1 schema and validated with no errors |
FX_KOSIT_CONF |
Archive of the KoSIT validator configuration for XRechnung 3.0.2, release 2026-08-31 | The regenerated CII D16B schema tables are identical to those in the repository (go generate -run D16B in internal/schema downloads the archive and checks its SHA-256 and that of each XSD) |
FX_FNFE |
Clone of fnfempe/France_RFE, tag v1.4.0.04 | The CII and Factur-X examples (Z.example/TEST) respect the schema of their profile and the CII D22B schema; checked as EXTENDED-CTC-FR, they break no syntax rule of its schematron; the D22B tables (compiled for tests only) and the ctcfr_gen.go catalogue (go generate in internal/rules/en16931 downloads the schematron and checks its SHA-256) are identical to those in the repository |
FX_PEPPOL |
Clone of OpenPEPPOL/peppol-bis-invoice-3, version 3.0.21 or later | The 351 CII unit tests (rules/unit-CII-*) and the 678 UBL unit tests (rules/unit-UBL-*) give the result the schematron expects; the official examples (rules/examples, rules/snippets) pass validation with no errors |
FX_NL |
Clone of peppolautoriteit-nl/validation, release 2026-05-21 | Each assertion of the NLCIUS (CII), SI-UBL 2.0 and G-account (UBL) patterns appears in the catalogue of its syntax with its severity and message, except those that never fire |
FX_NL_TESTS |
simplerinvoicing folder of the test files of phax/phive-rules
|
The SI-UBL 2.0.3.2, NLCIUS-CII 1.0.3 and G-account 1.0 files raise the BR-NL or BR-GA rule their name gives, with its severity; those that break none pass the full validation with no errors |
FX_UBL_ZIP |
OASIS package UBL-2.1.zip | The regenerated UBL schema tables are identical to those in the repository (go generate -run -ubl in internal/schema downloads the package and checks its SHA-256) |
FX_VERAPDF |
PDF_A-2b and PDF_A-3b folders of veraPDF/veraPDF-corpus
|
No valid file raises a PDF/A error, each invalid file raises a rule of its clause, except the files listed with their reason |
FX_FACTURX_SCH |
Factur-X 1.09.2 schematrons of BASIC, EN 16931 and EXTENDED and their code lists (FACTUR-X_<profile>.sch and FACTUR-X_<profile>_codedb.xml) |
The regenerated code list assertions (codedb_gen.go) are identical to those in the repository (go generate in internal/rules/facturx downloads the files and checks their SHA-256) |
FX_FATTURAPA |
The six FatturaPA 1.2 examples of fatturapa.gov.it (IT01234567890_FPA01.xml to FPA03, FPR01 to FPR03), whose terms of use forbid copying them into the repository |
Each invoice is read with no issue nor extension, written back with no loss, and read again as the same invoice; FPR02 breaks the FatturaPA schema (misplaced ContattiTrasmittente), the others respect it |
FX_FATTURAPA_XSD |
The FatturaPA XML schemas 1.2.4 and 1.2.3 of fatturapa.gov.it and the W3C xmldsig schema they import; needs xmllint (libxml2-utils) |
The regenerated FatturaPA schema tables are identical to those in the repository (go generate -run -fatturapa in internal/schema downloads the XSD and checks its SHA-256); the XSD 1.2.3 gives the same tables but for the tax regime RF21; xmllint accepts and rejects the same documents as the package: the test documents, 24 mutations and the official examples |
FX_FACTURAE_XSD |
The Facturae XML schemas 3.2, 3.2.1 and 3.2.2 of facturae.gob.es (Facturaev3_2.xml, Facturaev3_2_1.xml, Facturaev3_2_2.xml) |
The regenerated Facturae schema tables are identical to those in the repository (go generate -run -facturae in internal/schema downloads the schemas and checks their SHA-256) |
The results of these tests on the official corpora are summarised on Coverage and accuracy.
ZeRechnung
Guides
- Creating invoices
- Reading invoices
- Validating invoices
- Coverage and accuracy
- Testing
- License and provenance
By country
- Facturer en France
- E-Rechnungen in Deutschland
- E-facturen in Nederland
- Fatturazione elettronica in Italia
- Facturación electrónica en España
- Guides par pays
En français