It depends on the value of TestLevel
and any other classes that are already in production.
If TestLevel
is set to RunLocalTests
, and the average code coverage exceeds 75%, then your deployment succeeds, otherwise it fails. If you have exactly those three classes in your example, and you specify RunLocalTests
, then the deployment would succeed. If you had many other classes, some with low coverage, the deployment could fail. The calculation is indeed "number of lines covered divided by total coverable lines of code must exceed 0.75 (75%)." Some code, like unit tests and comments, do not count for or against these calculations.
Contrariwise, if TestLevel
is set to RunSpecifiedTests
, then each class must independently have 75% coverage for the deployment to succeed, otherwise it fails. If you have exactly those three classes in your example deploying all at once, and you specify RunSpecifiedTests
, then the deployment would fail. Note that classes that are not referenced in any test with RunSpecifiedTests
do not contribute to this calculation. As long as the third class was already preexisting, and it was not touched by any unit test (e.g. neither of the first two classes referenced it), the deployment would succeed.
As you can see, success or failure will depend on the TestLevel
used, as well as which classes are involved. Of course, if you also have triggers, you need to consider that those triggers must have some coverage (defined as 1%) when using RunLocalTests
, but must have 75% when using RunSpecifiedTests
, which might influence your decision on which mode to use. Note that RunLocalTests
takes more time, but is effectively more lenient, while RunSpecifiedTests
is faster, but stricter.