All docs pages (49)
Apex Tests
See Apex code coverage for your org and each class or trigger, and start a run of all local Apex tests and watch its progress and failures.
Updated 2026-11-09
Apex Tests shows the Apex code coverage Salesforce has recorded for your org, class by class, and lets you start a run of the org's local tests and follow it to the end. Open Develop → Apex Tests (in the BUILD & DEBUG section).
How to use it
- Open the page. Coverage loads on its own. Click Refresh at the top to load it again.
- To run tests, click Run all local tests in the Run tests panel. The run starts right away; there is no confirmation step.
- Watch the status, the method count and the progress bar. When the run ends, coverage reloads.
- Use the search box in the coverage table (Search classes & triggers…) to find a class, and sort by any column.
If a run is already going in the org, for example one started from Setup or from another tab, the page attaches to that run instead of starting a second one. It also attaches to a running test run when you open the page.
What you see
Coverage numbers. Org-wide coverage, Classes & triggers, Below threshold (classes and triggers under 75%) and Lines covered.
Coverage table. One row per class or trigger with Class / Trigger, Covered (lines covered out of total) and Coverage (a percentage and a bar). It starts sorted with the lowest coverage first, and you can export it.
Warnings. No code coverage recorded yet appears when Salesforce has no coverage stored, which happens until tests have run. Below production-deploy threshold appears when org-wide coverage is under 75%.
Run status. The run's status from Salesforce (for example Queued, Processing or Completed), methods completed out of methods queued, and the number of failures. After the run, a Failures list shows each test that did not pass as Class.method with its message. In version 1.1.13 that includes skipped tests (shown as "Test failed"); in the release after 1.1.13 only failed tests and compile failures are listed.
If the run sits in the queue for more than 90 seconds, a note explains that Salesforce hasn't started it yet and that you don't need to run it again. If Salesforce refuses to start the run, the page says so; the usual reason is that the org has no Apex test classes.
What it reads and writes
Reads, through Tooling API queries with your current session:
ApexOrgWideCoveragefor the org-wide percentage, andApexCodeCoverageAggregatefor each class and trigger.ApexTestRunResultandApexTestResultto follow a run and collect its results.
Writes: Run all local tests calls the Tooling API's runTestsAsynchronous with the test level RunLocalTests. As the panel says, this runs every local (non-managed) test class in the org. Salesforce stores coverage data only after a test run, so a run updates the numbers this page shows. The page does not edit or deploy code.
Limits
- You can only run all local tests. You can't pick single classes or methods here.
- The coverage table reads at most 2,000 classes and triggers. If the org-wide percentage can't be read, the page works it out from those rows.
- Up to 200 non-passing test results are read per run.
- The page checks the run every 3 seconds at first, slowing to every 30 seconds, and pauses while the tab is hidden. After an hour it stops checking to save API calls and shows Keep watching. The run itself keeps going in Salesforce, and you can follow it in Setup under Apex Test Execution.
- Stack traces of failed tests are read but not shown.