APEX Mocking Frameworks: Just too many choices

Target Group: Developers
Complexity: Medium

Disclaimer: This is not a comprehensive comparison but is based on my limited experience. Any feedback is highly welcome.

Way too late in my career, I started using mocking frameworks. Now, I’ve too many mocking frameworks to choose from. I was wondering, what’s the difference and what’s the best one to choose for my personal or team projects.

I used the OG of mocking frameworks: FFLIB APEX Mocks as my first contender. As a stand-in for all modern/new mocking frameworks, I used Amoss.

Summary:
The difference between FFLIB and Amoss is quite small. A basic implementation looks almost the same. I found Amoss more flexible and slightly more powerful. 

Personal projects:
I personally prefer Amoss for its smaller footprint, powerful spy, and clear documentation. 

Team projects:
Since FFLIBI is the defacto community standard, for most teams FFLIB is properly the right choice.

FFLIB APEX Mocks: 

1) Overview
– Concept: Stub OR Interface based
– Developed: 2014
– Dev. Group: Was large
– Active Development: Yes
– Popularity: High

1) Features
1.1 Stubing classes: Yes
1.2 sObject generator: Yes
1.3 Spy/Watcher: Limited

2) Easy to install: Yes

3) Documentation: Not too good broken links, old blog, complex to follow but many videos and secondary blogs.

4) Easy to understand: Yes

5) Footprint: Large

Amoss APEX Mocks: 

1) Overview
– Concept: Stub based
– Developed: 2020
– Dev. Group: Small
– Active Development: Yes
– Popularity: Medium

1) Features
1.1 Stubing classes: Yes
1.2 sObject generator: No, SObjectFabricator needed
1.3 Spy/Watcher: Amazing

2) Easy to install: Yes

3) Comprehensive documentation: Yes, nothing missing, easy to follow, not much community content

4) Easy to understand: Yes

5) Footprint: Medium

PS: Thanks to all the people who give us such powerful free libraries.

Thanks to Robert Baillie for answering my questions.

Discover more from Cloud Johann

Subscribe now to keep reading and get access to the full archive.

Continue reading