Be assert-ive!
Just calling (invoking) your methods so that they run and covering your code is not testing! Let's be clear about that. By calling your methods, you will only get code coverage. You could get enough code coverage to be able to deploy, but you're not testing whether the outcome is the actual outcome that you expect!
By being "assert"-ive, I mean that you should test any expected results by using the System.assert(Boolean), System.assertEquals('expected value', 'actual value'), and System.assertNotEquals('expected value', 'actual value') methods. These methods are used to compare the results of your logic against an expected value. The System.assert(Boolean) function always needs a true Boolean. With this function, you are able ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access