130k views
1 vote
What percentage of Apex code must be covered by unit tests?

User Irobotxx
by
8.2k points

1 Answer

1 vote

Final answer:

In Salesforce, 75% of Apex code must be covered by unit tests.

Step-by-step explanation:

In Salesforce, the percentage of Apex code that must be covered by unit tests is 75%. This means that at least 75% of the Apex code in an organization must have associated unit tests. It is important to note that this percentage refers to the code coverage for all Apex code, including triggers, classes, and controllers.

For example, if an organization has 100 lines of Apex code, at least 75 lines need to be covered by unit tests.

By maintaining a high code coverage percentage, developers can ensure that their code is tested and more likely to be free of bugs and issues when deployed.

User Marcel Zebrowski
by
8.2k points