Customers using a custom Apex invocable class to invoke quote repricing through the Place Sales Transaction execution path may observe an intermittent System.LimitException: Apex CPU time limit exceeded error specifically during unit test execution of that method, while the identical method executed live (via Execute Anonymous or normal application flow) consistently completes within a few seconds.
Debug log analysis shows the majority of CPU time is consumed within the underlying pricing execution framework rather than in the custom extension logic for pricing. Log comparisons between live and test execution reveal that the pricing framework experiences cache misses in the test context that do not occur in live execution, adding several seconds of processing overhead.
Apex test execution runs in an isolated transaction context, cached data available during live execution (such as pricing/business rule caches) is not available, resulting in longer execution and higher CPU consumption. This behavior has been observed across multiple environments and does not correlate with a specific custom configuration or code change, making it appear intermittent.
This has been confirmed as expected platform behavior tied to test-context cache isolation, not a code defect. As a workaround, avoid asserting on strict CPU time thresholds within unit tests that exercise the pricing/repricing execution path, since test-context timing will differ from live execution.
Where possible, reduce the volume/complexity of data used in the test scenario, And isolate the repricing call so it can be tested with smaller scope, to reduce the chance of intermittently exceeding the synchronous Apex CPU limit during test runs.
Note : Place Sales Transaction apex execution can not provide runtime guarantees with Config and Pricing preferences set to System/Force within the PST payload and ideal unit tests for the same can be performed with setting these preferences to Skip.
005460598

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.