Skip to main content

3 posts tagged with "Apex"

Articles about Salesforce Apex and code quality

View All Tags

Deploy Salesforce Apex Without Failing the 75% Test Coverage Rule

· 5 min read
Alina Hubaidullina
Salesforce Consultant

You push an Apex change to production and the deployment stops:

Average test coverage across all Apex Classes and Triggers is 71%, at least 75% test coverage is required to complete this deployment.

It passed in the sandbox. In production, the org-wide coverage gate — and the rule that one failing test fails the whole deploy — blocks the release. mtdt.io avoids this by recommending exactly which unit tests cover your change, so you deploy with Run Specified Tests — a targeted run — instead of RunAllTests against the whole org.

Deploy Scheduled Apex Without 'Jobs Pending or in Progress'

· 4 min read
Alina Hubaidullina
Salesforce Consultant

You update a Schedulable Apex class, deploy it to an org where it's running, and Salesforce stops you:

This schedulable class has jobs pending or in progress.

The class is locked while it has a scheduled job. And even once you get past that, the schedule doesn't come with it — Salesforce deploys the class, not the running job.

Salesforce Static Code Analysis: Catch Apex Problems Before They Ship

· 5 min read
Aliaksandr Kliazovich
Salesforce Developer

Salesforce makes you hit 75% Apex test coverage to deploy to production. It's an easy target to game — and it proves only that your code runs, not that it's fast, safe, or maintainable. Coverage is not quality.

The issues that actually bite — a SOQL query inside a loop, an unhandled exception, a hardcoded ID, a sharing leak — sail straight through a coverage check and surface later as governor-limit errors, slow pages, or a security finding. Static analysis is how you catch them before they ship: mtdt.io runs the industry-standard analyzer PMD across your org's Apex, on demand or on a schedule, and reports every violation ranked by severity.