nerdexam
Salesforce

PDI · Question #79

A developer creates a new Apex trigger with a helper class, and writes a test class that only exercises 95% coverage of new Apex helper class. Change Set deployment to production fails with the test…

The correct answer is A. Create a test class and methods to cover the Apex trigger. Salesforce requires that all Apex triggers have at least 1% code coverage, and covering the helper class alone is insufficient; the trigger's own execution paths must be exercised by a test class.

Submitted by akirajp· Apr 18, 2026Testing, Debugging, and Deployment

Question

A developer creates a new Apex trigger with a helper class, and writes a test class that only exercises 95% coverage of new Apex helper class. Change Set deployment to production fails with the test coverage warning: "Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required" What should the developer do to successfully deploy the new Apex trigger and helper class?

Options

  • ACreate a test class and methods to cover the Apex trigger
  • BRun the tests using the 'Run All Tests' method.
  • CRemove the falling test methods from the test class.
  • DIncrease the test class coverage on the helper class

How the community answered

(47 responses)
  • A
    87% (41)
  • B
    2% (1)
  • C
    2% (1)
  • D
    9% (4)

Why each option

Salesforce requires that all Apex triggers have at least 1% code coverage, and covering the helper class alone is insufficient; the trigger's own execution paths must be exercised by a test class.

ACreate a test class and methods to cover the Apex triggerCorrect

Even if the helper class has high coverage, a trigger itself must have its execution paths invoked and covered by a test method. The error message explicitly states "Test coverage of selected Apex Trigger is 0%", meaning the test class isn't calling the trigger's logic, requiring specific test methods to create/update/delete records that fire the trigger.

BRun the tests using the 'Run All Tests' method.

Running all tests might help identify other issues but will not inherently add coverage to a specific trigger if no test methods are designed to invoke it.

CRemove the falling test methods from the test class.

Removing failing test methods would not address the 0% coverage on the trigger and is generally bad practice as it reduces test robustness.

DIncrease the test class coverage on the helper class

While increasing helper class coverage is good practice, it does not directly address the 0% coverage requirement for the trigger itself, as the trigger must be invoked by test data to gain coverage.

Concept tested: Apex Trigger test coverage requirements

Source: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_tests.htm

Topics

#Apex Trigger Testing#Test Coverage#Deployment Requirements#Apex Testing

Community Discussion

No community discussion yet for this question.

Full PDI Practice