nerdexam
Salesforce

PDI · Question #103

A developer created this Apex trigger that calls MyClass,myStartmethod: The developer creates a test method that calls MyClase,myStartmethod directly, resulting in 81% overall code coverage. What…

The correct answer is A. The deployment fails because the Apr-MgQM has no code coverage. The deployment will fail because while the overall code coverage is 81%, the Apex trigger itself has 0% coverage, and all triggers require at least 1% coverage for deployment to production.

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

Question

A developer created this Apex trigger that calls MyClass,myStartmethod:

The developer creates a test method that calls MyClase,myStartmethod directly, resulting in 81% overall code coverage. What happens wtier the developer tries to deploy the ... and two classes to production, assuming no other code exists?

Options

  • AThe deployment fails because the Apr-MgQM has no code coverage.
  • BThe deployment tails because no assertions mett made in the lest method.
  • CThe deployment passes became the Apex code has the requited 75% code coverage.
  • DThe deployment passes because both classes and the trigger were included ki the deployment.

How the community answered

(31 responses)
  • A
    71% (22)
  • B
    16% (5)
  • C
    3% (1)
  • D
    10% (3)

Why each option

The deployment will fail because while the overall code coverage is 81%, the Apex trigger itself has 0% coverage, and all triggers require at least 1% coverage for deployment to production.

AThe deployment fails because the Apr-MgQM has no code coverage.Correct

For deployment to production, all Apex triggers must have at least 1% code coverage from test methods, and since the test method only called MyClass.myStartMethod directly, the trigger that calls it initially was not executed, resulting in 0% coverage for the trigger.

BThe deployment tails because no assertions mett made in the lest method.

While assertions are best practice for robust tests, their absence alone does not necessarily cause deployment failure if the minimum code coverage requirements are met.

CThe deployment passes became the Apex code has the requited 75% code coverage.

The overall 75% code coverage requirement applies to all deployable Apex code combined, but individual deployable components like triggers also have specific minimum coverage requirements (1%).

DThe deployment passes because both classes and the trigger were included ki the deployment.

Including classes and triggers in deployment does not bypass the code coverage requirements, which dictate that each trigger must have at least 1% coverage.

Concept tested: Apex code coverage for deployment

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

Topics

#Apex Testing#Code Coverage#Deployment#Apex Triggers

Community Discussion

No community discussion yet for this question.

Full PDI Practice