Definition
Apex Test Execution is a Setup page that allows administrators and developers to run Apex test classes and test methods in the org. It provides options to run all tests, selected test classes, or a test suite, and displays real-time results including pass/fail status, code coverage percentages, and error details for failed tests.
Real-World Example
a developer at Quantum Labs uses Apex Test Execution to build a custom solution that extends the platform beyond its standard capabilities. They write clean, bulkified code for Apex Test Execution, add comprehensive test coverage, and deploy it through a CI/CD pipeline. The new functionality handles 10,000 records without hitting governor limits.
Why Apex Test Execution Matters
Apex Test Execution is the Setup page developers and admins use to run Apex tests in an org. From this page you can run all tests in the org, pick specific test classes or methods, or select a pre-defined test suite. Results include pass/fail status for each method, code coverage percentages per class, and detailed error messages and stack traces for any failing test. The page also supports running tests asynchronously so you can kick off a long-running suite and check back later.
Code coverage matters in Salesforce because the platform requires at least 75% of all Apex code in a production org to be covered by tests before a deployment will succeed. Apex Test Execution is the most common place to check coverage before pushing code, and it's the first place to look when a deployment fails due to insufficient coverage. The page is also useful for debugging test failures, since it shows the exact assertion that failed along with the line numbers.
How Organizations Use Apex Test Execution
- •Quantum Labs — Runs all tests through Apex Test Execution before every deployment to production. The team has standardized on running the full suite asynchronously overnight so that deployment-day failures are caught before morning standup.
- •CodeBridge — Uses Apex Test Execution to investigate failing tests in a sandbox after a metadata refresh. The detailed error messages on the results page are faster for triaging than digging through CLI output.
- •TerraForm Tech — Maintains a named Test Suite for their critical business logic classes, which they run through Apex Test Execution as a smoke test after every configuration change. It catches accidental breakage from even non-code edits.
