Add golden-file regression tests for FIX42 and FIX44 code generation#1202
Add golden-file regression tests for FIX42 and FIX44 code generation#1202
Conversation
Agent-Logs-Url: https://github.com/quickfix-j/quickfixj/sessions/75ce6f0f-805a-433f-94f2-f4a1744e2c24 Co-authored-by: chrjohn <6644028+chrjohn@users.noreply.github.com>
Agent-Logs-Url: https://github.com/quickfix-j/quickfixj/sessions/75ce6f0f-805a-433f-94f2-f4a1744e2c24 Co-authored-by: chrjohn <6644028+chrjohn@users.noreply.github.com>
|
@copilot please add a readme on what to do on a generator change. |
…ator changes Agent-Logs-Url: https://github.com/quickfix-j/quickfixj/sessions/ba2b68dc-4d0c-457e-98ee-353d16aedb3c Co-authored-by: chrjohn <6644028+chrjohn@users.noreply.github.com>
Added |
|
@copilot the generator has too verbose output. We don't need to log every single generated field, message and component. |
Agent-Logs-Url: https://github.com/quickfix-j/quickfixj/sessions/55fa23a6-aa70-48b2-96c8-47249dd99eaf Co-authored-by: chrjohn <6644028+chrjohn@users.noreply.github.com>
Fixed in commit |
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.javafiles generated from the real FIX42/FIX44 dictionaries (fromquickfixj-messages-fix42andquickfixj-messages-fix44), withorderedFields=trueanddecimalGenerated=true. These are the reference baseline.GoldenFileTest.java— two JUnit tests:testFix42GenerationMatchesGolden— runs the generator against the real FIX42 dict, diffs every.javaagainst goldentestFix44GenerationMatchesGolden— same for FIX44On 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 verbosity —
logDebuginMessageCodeGeneratoris now a no-op by default, suppressing the per-field, per-message, and per-component log lines during standalone use.MavenMessageCodeGeneratorcontinues to forward debug messages to Maven'slog.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
MessageCodeGeneratordirectly against the two dictionaries (same parameters as the test) and commit the updated golden files alongside the generator change. Seesrc/test/resources/golden/README.mdfor full instructions.