SlideShare a Scribd company logo
Salesforce
Developer Group
Bilbao, 11 de Marzo, 2016
Agenda
 Bienvenidos!!
 Presentaciones - ¿tenemos nuevos miembros?
 Unit tests – ApexMocks – David van Alphen
 Descanso
 ¿Qué os interesa en el próximo SDG?
 Comunidad
Bienvenidos!!!
 ¿Qué es SDG? (aka DUG)
 ¿Nuevos miembros?
ApexMocks
by
David van Alphen
Dev/Test Theory
 OO Principles – SOLID
 Dependency Injection
 Enterprise Patterns
 Separation of Concerns
 Mocking / Stubbing
 Mockito, NSubstitute, etc
SOLID
 Wikipedia - SOLID
 SRP – Single Responsibility Principle
 A class should have one responsibility
 O – Open/Closed Principle
 Open for extension, closed for modification
 L – Liskov Substitution Principle
 Objects should be replaceable by subtypes without affecting correctness of
application
 I – Interface Separation Principle
 Many specific interfaces are better than one general interface
 D – Dependency Injection Principle
 Depend on abstract, not concrete classes
Dependency Injection
 Wikipedia - Dependency Injection
 No Static methods (workaround available)
 Constructors
 Setters
Salesforce & Testing
 Apex tests
 System or integration tests
 Unit tests
 Apexmocks framework
 Mix and Match
Mockito vs Apexmocks
 Apex vs Java
 No Generics, explicit typing
 Concrete classes
 Compile on platform
Apexmocks Generator
 interfacemocks.properties
 IMyClass=MyClass:MyParentClassOrInterface
 Mocks.cls
 .gitignore (or equivalent)
Code example 1
Code example 2
Test Structure
 Given
 Arrange things needed for the test
 When
 Trigger the behavior we want to test
 Then
 Confirm the results are what we expected
Code example 3
Things to Avoid
 Always focus on testing public / interface behaviour
 Use the framework wisely - don’t verify more behaviour
than you need to
 Don’t mock too deeply - if you find your unit test having
to set up a lot of mocking before you even trigger the
behaviour under test, that’s probably a hint that your
design could be better
Documentation and Help
 Examples found in ApexMocks classes and tests
 Code4cloud
 GitHub
 Andyinthecloud.com - Unit Testing, Apex Enterprise Patterns
and ApexMocks Part 1
 Andyinthecloud.com - Unit Testing, Apex Enterprise Patterns
and ApexMocks Part 2
 Feature Enhancements – fork repo on GitHub
Questions?
Video recording
Comunidad de Salesforce
 Customer Success Community en Español
 Después de uniros haced un comentario en chatter
nombrando a @Carolina Ruiz Medina
(FinancialForce.com) y preguntad por MVP hours
 Spanish Developers Success Community
 Spanish User Group
 StackExchange – Preguntas y respuestas
 Developer Forums y otros
 Slides Share
Sorteo
Platform Developer I
Salesforce Certification
¡¡GRACIAS!!
Nos vemos en el
próximo SGD

More Related Content

What's hot

Regression Suite Optimization
Regression Suite OptimizationRegression Suite Optimization
Regression Suite Optimization
STAG Software Private Limited
 
How to get the most out of code reviews
How to get the most out of code reviewsHow to get the most out of code reviews
How to get the most out of code reviews
JavaDayUA
 
Geecon09: SOLID Design Principles
Geecon09: SOLID Design PrinciplesGeecon09: SOLID Design Principles
Geecon09: SOLID Design Principles
Bruno Bossola
 
UXDX London 2018 Nik Crabtree - Enhancing the Processes of Test Driven Develo...
UXDX London 2018 Nik Crabtree - Enhancing the Processes of Test Driven Develo...UXDX London 2018 Nik Crabtree - Enhancing the Processes of Test Driven Develo...
UXDX London 2018 Nik Crabtree - Enhancing the Processes of Test Driven Develo...
UXDXConf
 
SpecFlow Executable Specifications
SpecFlow Executable SpecificationsSpecFlow Executable Specifications
SpecFlow Executable Specifications
Sam Leach
 
TDD and the Terminator: An Introduction to Test-Driven Development
TDD and the Terminator: An Introduction to Test-Driven DevelopmentTDD and the Terminator: An Introduction to Test-Driven Development
TDD and the Terminator: An Introduction to Test-Driven Development
VMware Tanzu
 
The Solid Principles
The Solid PrinciplesThe Solid Principles
The Solid Principles
Luke Smith
 
Unwritten Manual for Pair Programming
Unwritten Manual for Pair ProgrammingUnwritten Manual for Pair Programming
Unwritten Manual for Pair Programming
Lemi Orhan Ergin
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Developmentbhochhi
 
Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...
Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...
Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...
mCloud
 
Testing the untestable
Testing the untestableTesting the untestable
Testing the untestable
RoyKlein
 
A journey to_be_a_software_craftsman
A journey to_be_a_software_craftsmanA journey to_be_a_software_craftsman
A journey to_be_a_software_craftsman
Jaehoon Oh
 
Aceu2009 Open Source For Interoperability
Aceu2009 Open Source For InteroperabilityAceu2009 Open Source For Interoperability
Aceu2009 Open Source For Interoperabilityguest60ed0b
 

What's hot (13)

Regression Suite Optimization
Regression Suite OptimizationRegression Suite Optimization
Regression Suite Optimization
 
How to get the most out of code reviews
How to get the most out of code reviewsHow to get the most out of code reviews
How to get the most out of code reviews
 
Geecon09: SOLID Design Principles
Geecon09: SOLID Design PrinciplesGeecon09: SOLID Design Principles
Geecon09: SOLID Design Principles
 
UXDX London 2018 Nik Crabtree - Enhancing the Processes of Test Driven Develo...
UXDX London 2018 Nik Crabtree - Enhancing the Processes of Test Driven Develo...UXDX London 2018 Nik Crabtree - Enhancing the Processes of Test Driven Develo...
UXDX London 2018 Nik Crabtree - Enhancing the Processes of Test Driven Develo...
 
SpecFlow Executable Specifications
SpecFlow Executable SpecificationsSpecFlow Executable Specifications
SpecFlow Executable Specifications
 
TDD and the Terminator: An Introduction to Test-Driven Development
TDD and the Terminator: An Introduction to Test-Driven DevelopmentTDD and the Terminator: An Introduction to Test-Driven Development
TDD and the Terminator: An Introduction to Test-Driven Development
 
The Solid Principles
The Solid PrinciplesThe Solid Principles
The Solid Principles
 
Unwritten Manual for Pair Programming
Unwritten Manual for Pair ProgrammingUnwritten Manual for Pair Programming
Unwritten Manual for Pair Programming
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...
Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...
Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...
 
Testing the untestable
Testing the untestableTesting the untestable
Testing the untestable
 
A journey to_be_a_software_craftsman
A journey to_be_a_software_craftsmanA journey to_be_a_software_craftsman
A journey to_be_a_software_craftsman
 
Aceu2009 Open Source For Interoperability
Aceu2009 Open Source For InteroperabilityAceu2009 Open Source For Interoperability
Aceu2009 Open Source For Interoperability
 

Similar to 11th Salesforce Developer Group meeting in Bilbao

ITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
ITARC15 Workshop - Architecting a Large Software Project - Lessons LearnedITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
ITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
João Pedro Martins
 
Strengthen and Scale Security for a dollar or less
Strengthen and Scale Security for a dollar or lessStrengthen and Scale Security for a dollar or less
Strengthen and Scale Security for a dollar or less
Mohammed A. Imran
 
Scale security for a dollar or less
Scale security for a dollar or lessScale security for a dollar or less
Scale security for a dollar or less
Mohammed A. Imran
 
Unit Testing Full@
Unit Testing Full@Unit Testing Full@
Unit Testing Full@Alex Borsuk
 
Enterprise Devops Presentation @ Magentys Seminar London May 15 2014
Enterprise Devops Presentation @ Magentys Seminar London May 15 2014Enterprise Devops Presentation @ Magentys Seminar London May 15 2014
Enterprise Devops Presentation @ Magentys Seminar London May 15 2014
Jwooldridge
 
Lublin Startup Festival - Mobile Architecture Design Patterns
Lublin Startup Festival - Mobile Architecture Design PatternsLublin Startup Festival - Mobile Architecture Design Patterns
Lublin Startup Festival - Mobile Architecture Design Patterns
Karol Szmaj
 
Strengthen and Scale Security Using DevSecOps - OWASP Indonesia
Strengthen and Scale Security Using DevSecOps - OWASP IndonesiaStrengthen and Scale Security Using DevSecOps - OWASP Indonesia
Strengthen and Scale Security Using DevSecOps - OWASP Indonesia
Mohammed A. Imran
 
Code Craftsmanship Checklist
Code Craftsmanship ChecklistCode Craftsmanship Checklist
Code Craftsmanship Checklist
Ryan Polk
 
SOLID Design Principles for Test Automaion
SOLID Design Principles for Test AutomaionSOLID Design Principles for Test Automaion
SOLID Design Principles for Test Automaion
Knoldus Inc.
 
So You Just Inherited a $Legacy Application… NomadPHP July 2016
So You Just Inherited a $Legacy Application… NomadPHP July 2016So You Just Inherited a $Legacy Application… NomadPHP July 2016
So You Just Inherited a $Legacy Application… NomadPHP July 2016
Joe Ferguson
 
So You Just Inherited a $Legacy Application...
So You Just Inherited a $Legacy Application...So You Just Inherited a $Legacy Application...
So You Just Inherited a $Legacy Application...
Joe Ferguson
 
DesignPrinciples-and-DesignPatterns
DesignPrinciples-and-DesignPatternsDesignPrinciples-and-DesignPatterns
DesignPrinciples-and-DesignPatterns
Basavaraj Patil
 
30 days or less: New Features to Production
30 days or less: New Features to Production30 days or less: New Features to Production
30 days or less: New Features to Production
Karthik Gaekwad
 
Elevate Tel Aviv
Elevate Tel AvivElevate Tel Aviv
Elevate Tel Aviv
sready
 
Android architecture
Android architectureAndroid architecture
Android architecture
Vandana Srivastava
 
Continuous Deployment and Testing Workshop from Better Software West
Continuous Deployment and Testing Workshop from Better Software WestContinuous Deployment and Testing Workshop from Better Software West
Continuous Deployment and Testing Workshop from Better Software West
Cory Foy
 
Practical DevOps
Practical DevOpsPractical DevOps
Practical DevOps
Naveen Kumar Singh
 
DevOps Maturity Curve v5
DevOps Maturity Curve v5DevOps Maturity Curve v5
DevOps Maturity Curve v5
Paul Peissner
 
Object Oriented Concepts and Principles
Object Oriented Concepts and PrinciplesObject Oriented Concepts and Principles
Object Oriented Concepts and Principles
deonpmeyer
 
Devops Powered by Splunk
Devops Powered by SplunkDevops Powered by Splunk
Devops Powered by Splunk
Splunk
 

Similar to 11th Salesforce Developer Group meeting in Bilbao (20)

ITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
ITARC15 Workshop - Architecting a Large Software Project - Lessons LearnedITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
ITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
 
Strengthen and Scale Security for a dollar or less
Strengthen and Scale Security for a dollar or lessStrengthen and Scale Security for a dollar or less
Strengthen and Scale Security for a dollar or less
 
Scale security for a dollar or less
Scale security for a dollar or lessScale security for a dollar or less
Scale security for a dollar or less
 
Unit Testing Full@
Unit Testing Full@Unit Testing Full@
Unit Testing Full@
 
Enterprise Devops Presentation @ Magentys Seminar London May 15 2014
Enterprise Devops Presentation @ Magentys Seminar London May 15 2014Enterprise Devops Presentation @ Magentys Seminar London May 15 2014
Enterprise Devops Presentation @ Magentys Seminar London May 15 2014
 
Lublin Startup Festival - Mobile Architecture Design Patterns
Lublin Startup Festival - Mobile Architecture Design PatternsLublin Startup Festival - Mobile Architecture Design Patterns
Lublin Startup Festival - Mobile Architecture Design Patterns
 
Strengthen and Scale Security Using DevSecOps - OWASP Indonesia
Strengthen and Scale Security Using DevSecOps - OWASP IndonesiaStrengthen and Scale Security Using DevSecOps - OWASP Indonesia
Strengthen and Scale Security Using DevSecOps - OWASP Indonesia
 
Code Craftsmanship Checklist
Code Craftsmanship ChecklistCode Craftsmanship Checklist
Code Craftsmanship Checklist
 
SOLID Design Principles for Test Automaion
SOLID Design Principles for Test AutomaionSOLID Design Principles for Test Automaion
SOLID Design Principles for Test Automaion
 
So You Just Inherited a $Legacy Application… NomadPHP July 2016
So You Just Inherited a $Legacy Application… NomadPHP July 2016So You Just Inherited a $Legacy Application… NomadPHP July 2016
So You Just Inherited a $Legacy Application… NomadPHP July 2016
 
So You Just Inherited a $Legacy Application...
So You Just Inherited a $Legacy Application...So You Just Inherited a $Legacy Application...
So You Just Inherited a $Legacy Application...
 
DesignPrinciples-and-DesignPatterns
DesignPrinciples-and-DesignPatternsDesignPrinciples-and-DesignPatterns
DesignPrinciples-and-DesignPatterns
 
30 days or less: New Features to Production
30 days or less: New Features to Production30 days or less: New Features to Production
30 days or less: New Features to Production
 
Elevate Tel Aviv
Elevate Tel AvivElevate Tel Aviv
Elevate Tel Aviv
 
Android architecture
Android architectureAndroid architecture
Android architecture
 
Continuous Deployment and Testing Workshop from Better Software West
Continuous Deployment and Testing Workshop from Better Software WestContinuous Deployment and Testing Workshop from Better Software West
Continuous Deployment and Testing Workshop from Better Software West
 
Practical DevOps
Practical DevOpsPractical DevOps
Practical DevOps
 
DevOps Maturity Curve v5
DevOps Maturity Curve v5DevOps Maturity Curve v5
DevOps Maturity Curve v5
 
Object Oriented Concepts and Principles
Object Oriented Concepts and PrinciplesObject Oriented Concepts and Principles
Object Oriented Concepts and Principles
 
Devops Powered by Splunk
Devops Powered by SplunkDevops Powered by Splunk
Devops Powered by Splunk
 

More from northspainsalesforcedevelopergroup

17th Salesforce Developer Group meeting in Bilbao
17th Salesforce Developer Group meeting in Bilbao17th Salesforce Developer Group meeting in Bilbao
17th Salesforce Developer Group meeting in Bilbao
northspainsalesforcedevelopergroup
 
Salesforce Elevate - Bilbao '17 - Separación de Conceptos - SoC
Salesforce Elevate - Bilbao '17 - Separación de Conceptos - SoCSalesforce Elevate - Bilbao '17 - Separación de Conceptos - SoC
Salesforce Elevate - Bilbao '17 - Separación de Conceptos - SoC
northspainsalesforcedevelopergroup
 
Salesforce Elevate - Bilbao '17 - Process automation with and without code
Salesforce Elevate - Bilbao '17 - Process automation with and without codeSalesforce Elevate - Bilbao '17 - Process automation with and without code
Salesforce Elevate - Bilbao '17 - Process automation with and without code
northspainsalesforcedevelopergroup
 
Salesforce Elevate - Bilbao '17 - Introducción FinancialForce
Salesforce Elevate - Bilbao '17 - Introducción FinancialForceSalesforce Elevate - Bilbao '17 - Introducción FinancialForce
Salesforce Elevate - Bilbao '17 - Introducción FinancialForce
northspainsalesforcedevelopergroup
 
Salesforce Elevate - Bilbao '17 - Introducción NTS
Salesforce Elevate - Bilbao '17 - Introducción NTSSalesforce Elevate - Bilbao '17 - Introducción NTS
Salesforce Elevate - Bilbao '17 - Introducción NTS
northspainsalesforcedevelopergroup
 
Salesforce Elevate - Bilbao '17 - Chatbot y Salesforce
Salesforce Elevate - Bilbao '17 - Chatbot y SalesforceSalesforce Elevate - Bilbao '17 - Chatbot y Salesforce
Salesforce Elevate - Bilbao '17 - Chatbot y Salesforce
northspainsalesforcedevelopergroup
 
Salesforce Elevate - Bilbao '17 - Introducción Salesforce
Salesforce Elevate - Bilbao '17 - Introducción SalesforceSalesforce Elevate - Bilbao '17 - Introducción Salesforce
Salesforce Elevate - Bilbao '17 - Introducción Salesforce
northspainsalesforcedevelopergroup
 
14th Salesforce Developer Group meeting in Bilbao
14th Salesforce Developer Group meeting in Bilbao14th Salesforce Developer Group meeting in Bilbao
14th Salesforce Developer Group meeting in Bilbao
northspainsalesforcedevelopergroup
 
12th Salesforce Developer Group meeting in Bilbao
12th Salesforce Developer Group meeting in Bilbao12th Salesforce Developer Group meeting in Bilbao
12th Salesforce Developer Group meeting in Bilbao
northspainsalesforcedevelopergroup
 
13th Salesforce Developer Group meeting in Bilbao
13th Salesforce Developer Group meeting in Bilbao13th Salesforce Developer Group meeting in Bilbao
13th Salesforce Developer Group meeting in Bilbao
northspainsalesforcedevelopergroup
 
9th Salesforce Developer Group meeting in Bilbao
9th Salesforce Developer Group meeting in Bilbao9th Salesforce Developer Group meeting in Bilbao
9th Salesforce Developer Group meeting in Bilbao
northspainsalesforcedevelopergroup
 
8th Salesforce Developer Group meeting in Bilbao
8th Salesforce Developer Group meeting in Bilbao8th Salesforce Developer Group meeting in Bilbao
8th Salesforce Developer Group meeting in Bilbao
northspainsalesforcedevelopergroup
 
6th Salesforce Developer Group - Bilbao
6th Salesforce Developer Group - Bilbao6th Salesforce Developer Group - Bilbao
6th Salesforce Developer Group - Bilbao
northspainsalesforcedevelopergroup
 
Salesforce Bilbao Elevate 2015 - Presentación principal y FinancialForce
Salesforce Bilbao Elevate 2015 - Presentación principal y FinancialForceSalesforce Bilbao Elevate 2015 - Presentación principal y FinancialForce
Salesforce Bilbao Elevate 2015 - Presentación principal y FinancialForce
northspainsalesforcedevelopergroup
 
Salesforce Elevate Bilbao 2015 - Desuto Presentación
Salesforce Elevate Bilbao 2015 - Desuto PresentaciónSalesforce Elevate Bilbao 2015 - Desuto Presentación
Salesforce Elevate Bilbao 2015 - Desuto Presentación
northspainsalesforcedevelopergroup
 
Salesforce Bilbao Elevate 2015 - Nts cloud computing y sfdc
Salesforce Bilbao Elevate 2015 - Nts cloud computing y sfdcSalesforce Bilbao Elevate 2015 - Nts cloud computing y sfdc
Salesforce Bilbao Elevate 2015 - Nts cloud computing y sfdc
northspainsalesforcedevelopergroup
 
Salesforce Bilbao Elevate '15 - 4th developer workshop
Salesforce Bilbao Elevate '15 - 4th developer workshopSalesforce Bilbao Elevate '15 - 4th developer workshop
Salesforce Bilbao Elevate '15 - 4th developer workshop
northspainsalesforcedevelopergroup
 
Salesforce Bilbao Elevate '15 - 3rd developer workshop
Salesforce Bilbao Elevate '15 - 3rd developer workshopSalesforce Bilbao Elevate '15 - 3rd developer workshop
Salesforce Bilbao Elevate '15 - 3rd developer workshop
northspainsalesforcedevelopergroup
 
Salesforce Bilbao Elevate '15 - 2nd developer workshop
Salesforce Bilbao Elevate '15 - 2nd developer workshopSalesforce Bilbao Elevate '15 - 2nd developer workshop
Salesforce Bilbao Elevate '15 - 2nd developer workshop
northspainsalesforcedevelopergroup
 
Salesforce Bilbao Elevate '15 - 1st developer workshop
Salesforce Bilbao Elevate '15 - 1st developer workshopSalesforce Bilbao Elevate '15 - 1st developer workshop
Salesforce Bilbao Elevate '15 - 1st developer workshop
northspainsalesforcedevelopergroup
 

More from northspainsalesforcedevelopergroup (20)

17th Salesforce Developer Group meeting in Bilbao
17th Salesforce Developer Group meeting in Bilbao17th Salesforce Developer Group meeting in Bilbao
17th Salesforce Developer Group meeting in Bilbao
 
Salesforce Elevate - Bilbao '17 - Separación de Conceptos - SoC
Salesforce Elevate - Bilbao '17 - Separación de Conceptos - SoCSalesforce Elevate - Bilbao '17 - Separación de Conceptos - SoC
Salesforce Elevate - Bilbao '17 - Separación de Conceptos - SoC
 
Salesforce Elevate - Bilbao '17 - Process automation with and without code
Salesforce Elevate - Bilbao '17 - Process automation with and without codeSalesforce Elevate - Bilbao '17 - Process automation with and without code
Salesforce Elevate - Bilbao '17 - Process automation with and without code
 
Salesforce Elevate - Bilbao '17 - Introducción FinancialForce
Salesforce Elevate - Bilbao '17 - Introducción FinancialForceSalesforce Elevate - Bilbao '17 - Introducción FinancialForce
Salesforce Elevate - Bilbao '17 - Introducción FinancialForce
 
Salesforce Elevate - Bilbao '17 - Introducción NTS
Salesforce Elevate - Bilbao '17 - Introducción NTSSalesforce Elevate - Bilbao '17 - Introducción NTS
Salesforce Elevate - Bilbao '17 - Introducción NTS
 
Salesforce Elevate - Bilbao '17 - Chatbot y Salesforce
Salesforce Elevate - Bilbao '17 - Chatbot y SalesforceSalesforce Elevate - Bilbao '17 - Chatbot y Salesforce
Salesforce Elevate - Bilbao '17 - Chatbot y Salesforce
 
Salesforce Elevate - Bilbao '17 - Introducción Salesforce
Salesforce Elevate - Bilbao '17 - Introducción SalesforceSalesforce Elevate - Bilbao '17 - Introducción Salesforce
Salesforce Elevate - Bilbao '17 - Introducción Salesforce
 
14th Salesforce Developer Group meeting in Bilbao
14th Salesforce Developer Group meeting in Bilbao14th Salesforce Developer Group meeting in Bilbao
14th Salesforce Developer Group meeting in Bilbao
 
12th Salesforce Developer Group meeting in Bilbao
12th Salesforce Developer Group meeting in Bilbao12th Salesforce Developer Group meeting in Bilbao
12th Salesforce Developer Group meeting in Bilbao
 
13th Salesforce Developer Group meeting in Bilbao
13th Salesforce Developer Group meeting in Bilbao13th Salesforce Developer Group meeting in Bilbao
13th Salesforce Developer Group meeting in Bilbao
 
9th Salesforce Developer Group meeting in Bilbao
9th Salesforce Developer Group meeting in Bilbao9th Salesforce Developer Group meeting in Bilbao
9th Salesforce Developer Group meeting in Bilbao
 
8th Salesforce Developer Group meeting in Bilbao
8th Salesforce Developer Group meeting in Bilbao8th Salesforce Developer Group meeting in Bilbao
8th Salesforce Developer Group meeting in Bilbao
 
6th Salesforce Developer Group - Bilbao
6th Salesforce Developer Group - Bilbao6th Salesforce Developer Group - Bilbao
6th Salesforce Developer Group - Bilbao
 
Salesforce Bilbao Elevate 2015 - Presentación principal y FinancialForce
Salesforce Bilbao Elevate 2015 - Presentación principal y FinancialForceSalesforce Bilbao Elevate 2015 - Presentación principal y FinancialForce
Salesforce Bilbao Elevate 2015 - Presentación principal y FinancialForce
 
Salesforce Elevate Bilbao 2015 - Desuto Presentación
Salesforce Elevate Bilbao 2015 - Desuto PresentaciónSalesforce Elevate Bilbao 2015 - Desuto Presentación
Salesforce Elevate Bilbao 2015 - Desuto Presentación
 
Salesforce Bilbao Elevate 2015 - Nts cloud computing y sfdc
Salesforce Bilbao Elevate 2015 - Nts cloud computing y sfdcSalesforce Bilbao Elevate 2015 - Nts cloud computing y sfdc
Salesforce Bilbao Elevate 2015 - Nts cloud computing y sfdc
 
Salesforce Bilbao Elevate '15 - 4th developer workshop
Salesforce Bilbao Elevate '15 - 4th developer workshopSalesforce Bilbao Elevate '15 - 4th developer workshop
Salesforce Bilbao Elevate '15 - 4th developer workshop
 
Salesforce Bilbao Elevate '15 - 3rd developer workshop
Salesforce Bilbao Elevate '15 - 3rd developer workshopSalesforce Bilbao Elevate '15 - 3rd developer workshop
Salesforce Bilbao Elevate '15 - 3rd developer workshop
 
Salesforce Bilbao Elevate '15 - 2nd developer workshop
Salesforce Bilbao Elevate '15 - 2nd developer workshopSalesforce Bilbao Elevate '15 - 2nd developer workshop
Salesforce Bilbao Elevate '15 - 2nd developer workshop
 
Salesforce Bilbao Elevate '15 - 1st developer workshop
Salesforce Bilbao Elevate '15 - 1st developer workshopSalesforce Bilbao Elevate '15 - 1st developer workshop
Salesforce Bilbao Elevate '15 - 1st developer workshop
 

Recently uploaded

Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
Kamal Acharya
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
Kamal Acharya
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
ShahidSultan24
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
MuhammadTufail242431
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
Kamal Acharya
 

Recently uploaded (20)

Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
 

11th Salesforce Developer Group meeting in Bilbao

  • 2. Agenda  Bienvenidos!!  Presentaciones - ¿tenemos nuevos miembros?  Unit tests – ApexMocks – David van Alphen  Descanso  ¿Qué os interesa en el próximo SDG?  Comunidad
  • 3. Bienvenidos!!!  ¿Qué es SDG? (aka DUG)  ¿Nuevos miembros?
  • 5. Dev/Test Theory  OO Principles – SOLID  Dependency Injection  Enterprise Patterns  Separation of Concerns  Mocking / Stubbing  Mockito, NSubstitute, etc
  • 6. SOLID  Wikipedia - SOLID  SRP – Single Responsibility Principle  A class should have one responsibility  O – Open/Closed Principle  Open for extension, closed for modification  L – Liskov Substitution Principle  Objects should be replaceable by subtypes without affecting correctness of application  I – Interface Separation Principle  Many specific interfaces are better than one general interface  D – Dependency Injection Principle  Depend on abstract, not concrete classes
  • 7. Dependency Injection  Wikipedia - Dependency Injection  No Static methods (workaround available)  Constructors  Setters
  • 8. Salesforce & Testing  Apex tests  System or integration tests  Unit tests  Apexmocks framework  Mix and Match
  • 9. Mockito vs Apexmocks  Apex vs Java  No Generics, explicit typing  Concrete classes  Compile on platform
  • 10. Apexmocks Generator  interfacemocks.properties  IMyClass=MyClass:MyParentClassOrInterface  Mocks.cls  .gitignore (or equivalent)
  • 13. Test Structure  Given  Arrange things needed for the test  When  Trigger the behavior we want to test  Then  Confirm the results are what we expected
  • 15. Things to Avoid  Always focus on testing public / interface behaviour  Use the framework wisely - don’t verify more behaviour than you need to  Don’t mock too deeply - if you find your unit test having to set up a lot of mocking before you even trigger the behaviour under test, that’s probably a hint that your design could be better
  • 16. Documentation and Help  Examples found in ApexMocks classes and tests  Code4cloud  GitHub  Andyinthecloud.com - Unit Testing, Apex Enterprise Patterns and ApexMocks Part 1  Andyinthecloud.com - Unit Testing, Apex Enterprise Patterns and ApexMocks Part 2  Feature Enhancements – fork repo on GitHub
  • 19. Comunidad de Salesforce  Customer Success Community en Español  Después de uniros haced un comentario en chatter nombrando a @Carolina Ruiz Medina (FinancialForce.com) y preguntad por MVP hours  Spanish Developers Success Community  Spanish User Group  StackExchange – Preguntas y respuestas  Developer Forums y otros  Slides Share
  • 21. ¡¡GRACIAS!! Nos vemos en el próximo SGD