I have written a test class for my apex class

The test class covers 98%.

but the test class fails.

will the coverage be considered.?

2 Answers 2


If your test class fails it will lead to a failed deployment or failed package upload, so your test class MUST pass.

Also, you should not write test classes to get coverage, but to actually test your code. Otherwise they would be called coverage classes and not test classes.


The test class needs to pass! Coverage is considered but

failed test class = failed deployment.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .