Customers can sometimes see a difference between the number of Apex test failures when running all tests or a single test via the UI compared to the failure count observed when performing a deployment. A comparison between the differences leads to the conclusion that they can be accounted for by observing 'Connection Canceled' errors in the UI but not in the deployment. Why does this happen?
During deployments, Salesforce does not enforce a fixed Apex test run time limit check, whereas running tests via the UI (either 'Run All Tests' or running a test for an individual class) does enforce this check. In the deployment context, this limit is relaxed. If the differences between the test failures seen in the UI compared to the deployment are solely down to 'Connection Canceled' errors, this is expected behavior — Salesforce intentionally does not perform this hard check during a deployment.
The same behavior can also be observed when simply running tests outside of a deployment or validation scenario, via the Metadata API. This is also expected behavior.
000396102

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.