The Unstoppable Hammer! OOps! @GopalAkshintala Suppress this and super constructor static init blocks Stub private methods static methods final methods Constructors Mock final classes
The Dark Powers 👹 Synthetic coverage is dangerous PowerMock is a new framework to learn Involves a lot of Setup and trail-and-error to get it right Tests written with PowerMock are brittle and difficult to Maintain It’s not Transparent OOps! @GopalAkshintala
PowerMock Compatibility Incompatible with JUnit 5 JUnit 5 was release 5 years ago Incompatible with Latest Mockito Latest Mockito: 4.20 Compatible version: 3.12 Not fully compatible with Java 11 OOps! @GopalAkshintala
UTests Use-case: How customer uses ITests should test Features Use-cases : Features : Components 1 Feature: Reflects software Functionality UTests should test Component Behaviour N N
UTests Traceability - How well a given test can precisely trace/pinpoint the cause of failure when it fails Productivity - Writing, Executing and Maintaining effort
@GopalAkshintala Anti-Patterns (digitaltapestry.net) https://confluence.internal.salesforce.com/display/TESTSFDC/ Unit+Testing+Best+Practices https://confluence.internal.salesforce.com/display/TESTSFDC/ Unit+Test+Recipes%3A+How+to+Write+High-Quality+Tests Explanation how proxy based Mock Frameworks work Write tests. Not too many. Mostly integration. (kentcdodds.com) Testing of Microservices - Spotify Engineering : Spotify Engineering (atspotify.com) On the Diverse And Fantastical Shapes of Testing (martinfowler.com) ongoing by Tim Bray · Testing in the Twenties (tbray.org) Resources