Stabilize partial sales shipment undo test#9672
Conversation
|
Could not find a linked ADO work item. Please link one by using the pattern 'AB#' followed by the relevant work item number. You may use the 'Fixes' keyword to automatically resolve the work item when the pull request is merged. E.g. 'Fixes AB#1234' |
| begin | ||
| // Test PostiveAdjmt Quantity on Whse Entry after undo Sales Shipment Line with Partial Qty when Items are created with Lot and Serial specific. | ||
| Initialize(); | ||
| Quantity := 100; |
There was a problem hiding this comment.
The partial-shipment divisor changes from LibraryRandom.RandInt(3) to a hardcoded 2, and Quantity changes from 100 to 10, removing randomized coverage from this test. A near-identical sibling test in the same codeunit (UndoSalesShipmentLinePartialWithAsmItemSerialAndItemtrackingSerial, Quantity := 100; ShipmentQuantity := Quantity / LibraryRandom.RandInt(3)) is left unchanged, so the same risk this edit avoids (a random divisor that can yield a non-integer partial quantity for a serial-tracked item) still exists elsewhere in the file. BCQuality guidance recommends using LibraryRandom.RandInt/RandDec to generate test values rather than hardcoding them; if the goal was to avoid a non-integer partial quantity, prefer a randomized-but-safe divisor (for example LibraryRandom.RandIntInRange over divisors known to divide evenly) instead of pinning both the quantity and the divisor to fixed literals, and apply the same fix to the sibling test if it has the same latent issue.
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.12.4
Problem
UndoSalesShipmentLinePartialWithAsmItemLotAndItemtrackingSerialuses 100 serial-tracked units and a random shipment divisor. This adds unnecessary warehouse activity and can make the supposed partial shipment a full shipment.Fix
Reduce the quantity to 10 and deterministically ship half. This keeps multiple serial numbers, guarantees a partial shipment, and removes accidental stress and randomness.
This ports the stabilization for ADO 640085 to BCApps main. Release ports are NAV PRs 251310 and 251313.
Validation
git diff --checkpassed.Risk
Low. Only test data is changed; product code is unaffected.