function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

TestMethods all above 75% but won't deploy

I have a test class with testMethods in, all of which cover above 75%. When I deploy, it still will not complete, it is giving me this error, which is an expected validation error. If I remove the piece of test code that causes this error, then the test coverage falls below 75%!

This makes no sense to me... does there need to be no expected errors in order to deploy?

The docs say for best practice use test code that will cause expected errors!

See screenshow below...

In order to deploy code there need to be no expected errors. You have to catch the error (try/catch block) otherwise your code will not run and you can't deploy it.
Ok thanks that has solved my problem!