r/sfdc • • May 04 '18

Idea: REMOVE the Apex Code Coverage Requirements

Please, hear me out cause this might sounds crazy. I am actually a tremendous advocate of automated testing. I actually want SFDC to offer better support for proper (atomic) unit testing in Apex, as well as to offer tools for end-to-end testing and mutation testing. I absolutely do NOT want developers creating solutions without tests.

BUT what is worse than no tests is poor tests: Too often I find myself on projects where the "test" code is not actually testing anything. It is merely exercising SFDC code. Maybe there are some meaningless assertions that can't fail to fool static analyzers and casual observers.

Why is this bad?

  1. If I have a high level of coverage, I should have a high level of confidence that a test will fail if I break something when refactoring. However, with poor quality tests, this is false confidence which endangers the projects.
  2. Creating these useless tests wastes developers time, when they might otherwise be developing something useful. It wastes employer and/or client money since they are paying for the time it takes to deliver these tests.
  3. It puts developers (either individually or collectively) into positions where they must choose between being repremanded (or even fired) for poorly perceived performance (because proper development time takes too long) OR being guilty (or at least complicit) of fraud, for creating code which does not do what it is supposed to do (e.g. "tests" which do not test).

Until and unless Salesforce will also enforce mutation testing, I don't believe they should continue enforcing coverage.

https://success.salesforce.com/ideaView?id=0873A000000E8nZQAS

3 Upvotes

0 comments sorted by