Skip to content

Add golden-file regression tests for FIX42 and FIX44 code generation#1202

Draft
Copilot wants to merge 4 commits intomasterfrom
copilot/ensure-message-code-generator-consistency
Draft

Add golden-file regression tests for FIX42 and FIX44 code generation#1202
Copilot wants to merge 4 commits intomasterfrom
copilot/ensure-message-code-generator-consistency

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 2, 2026

The code generator lacked regression tests that could catch unintended changes to generated output. FIX42 and FIX44 were chosen as the two reference dictionaries: FIX42 covers fields + messages + 38 repeating groups (no components), FIX44 covers fields + messages + components + 233 groups including nested ones.

Changes

  • Golden files (src/test/resources/golden/fix42/, .../fix44/) — 1492 committed .java files generated from the real FIX42/FIX44 dictionaries (from quickfixj-messages-fix42 and quickfixj-messages-fix44), with orderedFields=true and decimalGenerated=true. These are the reference baseline.

  • GoldenFileTest.java — two JUnit tests:

    • testFix42GenerationMatchesGolden — runs the generator against the real FIX42 dict, diffs every .java against golden
    • testFix44GenerationMatchesGolden — same for FIX44

    On mismatch the test fails with a precise per-file, per-line report. Missing or unexpected files are also caught.

  • src/test/resources/golden/README.md — documents the golden file workflow: directory layout, what the test does, and step-by-step instructions for regenerating golden files after an intentional generator change.

  • Reduced generator verbositylogDebug in MessageCodeGenerator is now a no-op by default, suppressing the per-field, per-message, and per-component log lines during standalone use. MavenMessageCodeGenerator continues to forward debug messages to Maven's log.debug(), which is silent unless Maven is run with -X.

Updating golden files

When a generator change is intentional, regenerate the golden files by running MessageCodeGenerator directly against the two dictionaries (same parameters as the test) and commit the updated golden files alongside the generator change. See src/test/resources/golden/README.md for full instructions.

@chrjohn
Copy link
Copy Markdown
Member

chrjohn commented May 2, 2026

@copilot please add a readme on what to do on a generator change.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 2, 2026

@copilot please add a readme on what to do on a generator change.

Added quickfixj-codegenerator/src/test/resources/golden/README.md in commit 0e67cd6. It covers the directory layout, what GoldenFileTest does, and the step-by-step workflow for regenerating the golden files after an intentional generator change (rebuild, regenerate, diff, re-run tests, commit together).

Copilot finished work on behalf of chrjohn May 2, 2026 16:23
Copilot AI requested a review from chrjohn May 2, 2026 16:23
@chrjohn
Copy link
Copy Markdown
Member

chrjohn commented May 2, 2026

@copilot the generator has too verbose output. We don't need to log every single generated field, message and component.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 2, 2026

@copilot the generator has too verbose output. We don't need to log every single generated field, message and component.

Fixed in commit dacfd12. logDebug in the base MessageCodeGenerator is now a no-op, so the per-field/message/component lines are no longer printed during standalone use. MavenMessageCodeGenerator still forwards to Maven's log.debug(), which is quiet by default and visible only when running with -X.

Copilot finished work on behalf of chrjohn May 2, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants