Skip to content

Harden FR Factur-X test setup against orphaned VAT posting groups#9172

Draft
JesperSchulz with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-unit-tests-failure
Draft

Harden FR Factur-X test setup against orphaned VAT posting groups#9172
JesperSchulz with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-unit-tests-failure

Conversation

Copilot AI commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

The FR unit test job was failing in Factur-X CII XML Tests before XML assertions ran. Test customer creation could inherit a VAT Bus. Posting Group code from shared test-library setup that did not exist in the FR test company.

  • Problem

    • FacturXCIIXMLTests relied on shared library-created posting setup data being internally consistent.
    • In the failing environment, customer setup referenced a missing VAT Business Posting Group, causing customer validation/posting to fail across the entire Factur-X suite.
  • Change

    • Added a small test-local guard in FacturXCIIXMLTests to ensure the referenced VAT Business Posting Group record exists before:
      • validating the customer’s VAT posting group
      • applying the G/L account’s VAT posting group during document setup
    • Extended test permissions to allow seeding the missing group record.
    • Seeded Description alongside Code so the inserted test record is minimally complete.
  • Why here

    • This keeps the fix scoped to the failing FR test setup.
    • No production behavior changes; only the test codeunit is hardened against incomplete shared setup data.
  • Example

    local procedure EnsureVATBusinessPostingGroupExists(VATBusPostingGroupCode: Code[20])
    var
        VATBusinessPostingGroup: Record "VAT Business Posting Group";
    begin
        if (VATBusPostingGroupCode = '') or VATBusinessPostingGroup.Get(VATBusPostingGroupCode) then
            exit;
    
        VATBusinessPostingGroup.Init();
        VATBusinessPostingGroup.Code := VATBusPostingGroupCode;
        VATBusinessPostingGroup.Description := VATBusPostingGroupCode;
        VATBusinessPostingGroup.Insert();
    end;

Copilot AI changed the title [WIP] Fix failing GitHub Actions job for unit tests Harden FR Factur-X test setup against orphaned VAT posting groups Jul 7, 2026
@github-actions github-actions Bot added the needs-approval Workflow runs require maintainer approval to start label Jul 7, 2026
Copilot AI requested a review from JesperSchulz July 7, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-approval Workflow runs require maintainer approval to start

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants