SalesforceWay

SalesforceWay


14. Unit Testing

April 08, 2019

Unit testing is an important programming skill but often times underestimated by programmers. David Reed shares what unit tests are and how to create good unit tests in Apex to guarantee production code quality.

Main points

75% code coverage in Salesforce ApexUnit testing definitionUnit test v.s. Integration testMocking in unit test5 Unit test scenarios to create good unit tests: 1) positive 2) single record 3) bulkified records 4) negative 5) no actionUnit tests as the documentationLines of unit test should be more than production codeHow to create good unit tests in SalesforceTest Driven Development (TDD)

Links:

David’s twitter handler David’s home pageDavid’s github  PMD Code Analysis Tool