SlideShare a Scribd company logo
Testing From The Trenches
May 22nd, 2014
Christopher Alun Lewis
Advanced Developer
Force.com MVP
A Developers Perspective
Simon Lawrence
Certified Developer
Force.com MVP
http://www.slideshare.net/SimonLawrence4
Why Do We Test?
• Testing is required by Salesforce.com to release code to production
environments
• Regression Protection Against Future Changes
• Salesforce make 3 Platform Releases a Year
• Residing in a Multi-Tenancy Environment
• To Rid Your Systems of Bugs
Testing on Salesforce
Our 5 Top Tips for Testing
#1 Always Include Assertions
• These are what we call “Skeleton Tests”
• Other than avoiding exceptions, provide almost no use
• Missing a great opportunity to provide feedback on future
failure scenarios
#1 Always Include Assertions
The Code
#1 Always Include Assertions
The Criminal Test
#1 Always Include Assertions
The Correct Test
#2 Remember your Batch Scenarios
• Your code may need to process large collections objects,
ensure that your tests cover this
• A serious consideration for testing your system’s ability to
operate within the governor limits
#2 Remember your Batch Scenarios
The Code
#2 Remember your Batch Scenarios
The Criminal Test
#2 Remember your Batch Scenarios
The Correct Test
#3 Test Roles with RunAs
• Test execution defaults to running as System Admin
• Using RunAs allows you to test your sharing rules and
record access rights
#3 Test Roles with RunAs
#3 Test Roles with RunAs
The Correct Test
#4 Test Every Branch of Logic
• Making sure test cases traverse every possible logical
route through your code
• Crucial pieces of logic can be hidden in IF/ELSE blocks
#4 Test Every Branch of Logic
The Code
#4 Test Every Branch of Logic
The Criminal Test
#4 Test Every Branch of Logic
The Coverage
#4 Test Every Branch of Logic
The Correct Test
#5 The 75% Squad
• Those developers who just strive to get to the 75% mark
• Normally guilty of most of the other crimes
• There’s no future for their code and their work
#5 The 75% Squad
The Code
#5 The 75% Squad
The Criminal Test
#5 The 75% Squad
The Coverage
The Wrap Up
• Always have test Assertions
• Batch test your Triggers
• RunAs different Users in your tests
• Cover every branch of your logical flow
• Don’t just aim for 75%
Resources
• These Slides
http://www.slideshare.net/SimonLawrence4
• Developer Resources
https://developer.salesforce.com
https://developer.salesforce.com/page/How_to_Write_Good_Unit_Tests
• Salesforce Stack Exchange
http://salesforce.stackexchange.com/
Thank You!
Christopher Alun Lewis
@ChrisAlunLewis
Simon Lawrence
@srlawr

More Related Content

What's hot

Google, quality and you
Google, quality and youGoogle, quality and you
Google, quality and you
nelinger
 
POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...
POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...
POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...
Postman
 
How to write better tests with Test Driven Development
How to write better tests with Test Driven DevelopmentHow to write better tests with Test Driven Development
How to write better tests with Test Driven Development
Alex Hoffman
 
Space Camp :: Introduction to API Security
Space Camp :: Introduction to API SecuritySpace Camp :: Introduction to API Security
Space Camp :: Introduction to API Security
Postman
 
Doing Security Testing in Agile with ease
Doing Security Testing in Agile with easeDoing Security Testing in Agile with ease
Doing Security Testing in Agile with ease
Karundeep Gill
 
Jenkins Test Automation with codeBeamer ALM
Jenkins Test Automation with codeBeamer ALMJenkins Test Automation with codeBeamer ALM
Jenkins Test Automation with codeBeamer ALM
Intland Software GmbH
 
DevSecCon Tel Aviv 2018 - End2End containers SSDLC by Vitaly Davidoff
DevSecCon Tel Aviv 2018 - End2End containers SSDLC by Vitaly DavidoffDevSecCon Tel Aviv 2018 - End2End containers SSDLC by Vitaly Davidoff
DevSecCon Tel Aviv 2018 - End2End containers SSDLC by Vitaly Davidoff
DevSecCon
 
DevSecCon Tel Aviv 2018 - Security learns to sprint by Tanya Janca
DevSecCon Tel Aviv 2018 - Security learns to sprint by Tanya JancaDevSecCon Tel Aviv 2018 - Security learns to sprint by Tanya Janca
DevSecCon Tel Aviv 2018 - Security learns to sprint by Tanya Janca
DevSecCon
 
PART 8 - Python Tutorial | User Input In Python With Examples
PART 8 - Python Tutorial | User Input In Python With ExamplesPART 8 - Python Tutorial | User Input In Python With Examples
PART 8 - Python Tutorial | User Input In Python With Examples
Shivam Mitra
 
Speeding Up the Dinosaur: Continuous Testing in Continuous Delivery - Martijn...
Speeding Up the Dinosaur: Continuous Testing in Continuous Delivery - Martijn...Speeding Up the Dinosaur: Continuous Testing in Continuous Delivery - Martijn...
Speeding Up the Dinosaur: Continuous Testing in Continuous Delivery - Martijn...
Codemotion
 
Utility of Test Coverage Metrics in TDD
Utility of Test Coverage Metrics in TDDUtility of Test Coverage Metrics in TDD
Utility of Test Coverage Metrics in TDD
XP Conference India
 
DevOps, CLI, APIs, Oh My! Security Gone Agile
DevOps, CLI, APIs, Oh My!  Security Gone AgileDevOps, CLI, APIs, Oh My!  Security Gone Agile
DevOps, CLI, APIs, Oh My! Security Gone Agile
Matt Tesauro
 
DevSecCon Tel Aviv 2018 - Value driven threat modeling by Avi Douglen
DevSecCon Tel Aviv 2018 - Value driven threat modeling by Avi DouglenDevSecCon Tel Aviv 2018 - Value driven threat modeling by Avi Douglen
DevSecCon Tel Aviv 2018 - Value driven threat modeling by Avi Douglen
DevSecCon
 
Blast Radius
Blast RadiusBlast Radius
Blast Radius
Frank Farrell
 
Expanding Your .NET Testing Toolbox - GLUG NET
Expanding Your .NET Testing Toolbox - GLUG NETExpanding Your .NET Testing Toolbox - GLUG NET
Expanding Your .NET Testing Toolbox - GLUG NET
Matt Eland
 
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
 
Tracking your Technical Debt with Sonarqube
Tracking your Technical Debt with SonarqubeTracking your Technical Debt with Sonarqube
Tracking your Technical Debt with Sonarqube
Puppet
 
Robot Framework Introduction & Sauce Labs Integration
Robot Framework Introduction & Sauce Labs IntegrationRobot Framework Introduction & Sauce Labs Integration
Robot Framework Introduction & Sauce Labs Integration
Sauce Labs
 
DevSecCon London 2017: Shift happens ... by Colin Domoney
DevSecCon London 2017: Shift happens ... by Colin Domoney DevSecCon London 2017: Shift happens ... by Colin Domoney
DevSecCon London 2017: Shift happens ... by Colin Domoney
DevSecCon
 
Sec4dev 2021 - Catch Me If You can : Continuous Delivery vs. Security Assurance
Sec4dev 2021  - Catch Me If You can : Continuous Delivery vs. Security AssuranceSec4dev 2021  - Catch Me If You can : Continuous Delivery vs. Security Assurance
Sec4dev 2021 - Catch Me If You can : Continuous Delivery vs. Security Assurance
Abdessamad TEMMAR
 

What's hot (20)

Google, quality and you
Google, quality and youGoogle, quality and you
Google, quality and you
 
POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...
POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...
POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...
 
How to write better tests with Test Driven Development
How to write better tests with Test Driven DevelopmentHow to write better tests with Test Driven Development
How to write better tests with Test Driven Development
 
Space Camp :: Introduction to API Security
Space Camp :: Introduction to API SecuritySpace Camp :: Introduction to API Security
Space Camp :: Introduction to API Security
 
Doing Security Testing in Agile with ease
Doing Security Testing in Agile with easeDoing Security Testing in Agile with ease
Doing Security Testing in Agile with ease
 
Jenkins Test Automation with codeBeamer ALM
Jenkins Test Automation with codeBeamer ALMJenkins Test Automation with codeBeamer ALM
Jenkins Test Automation with codeBeamer ALM
 
DevSecCon Tel Aviv 2018 - End2End containers SSDLC by Vitaly Davidoff
DevSecCon Tel Aviv 2018 - End2End containers SSDLC by Vitaly DavidoffDevSecCon Tel Aviv 2018 - End2End containers SSDLC by Vitaly Davidoff
DevSecCon Tel Aviv 2018 - End2End containers SSDLC by Vitaly Davidoff
 
DevSecCon Tel Aviv 2018 - Security learns to sprint by Tanya Janca
DevSecCon Tel Aviv 2018 - Security learns to sprint by Tanya JancaDevSecCon Tel Aviv 2018 - Security learns to sprint by Tanya Janca
DevSecCon Tel Aviv 2018 - Security learns to sprint by Tanya Janca
 
PART 8 - Python Tutorial | User Input In Python With Examples
PART 8 - Python Tutorial | User Input In Python With ExamplesPART 8 - Python Tutorial | User Input In Python With Examples
PART 8 - Python Tutorial | User Input In Python With Examples
 
Speeding Up the Dinosaur: Continuous Testing in Continuous Delivery - Martijn...
Speeding Up the Dinosaur: Continuous Testing in Continuous Delivery - Martijn...Speeding Up the Dinosaur: Continuous Testing in Continuous Delivery - Martijn...
Speeding Up the Dinosaur: Continuous Testing in Continuous Delivery - Martijn...
 
Utility of Test Coverage Metrics in TDD
Utility of Test Coverage Metrics in TDDUtility of Test Coverage Metrics in TDD
Utility of Test Coverage Metrics in TDD
 
DevOps, CLI, APIs, Oh My! Security Gone Agile
DevOps, CLI, APIs, Oh My!  Security Gone AgileDevOps, CLI, APIs, Oh My!  Security Gone Agile
DevOps, CLI, APIs, Oh My! Security Gone Agile
 
DevSecCon Tel Aviv 2018 - Value driven threat modeling by Avi Douglen
DevSecCon Tel Aviv 2018 - Value driven threat modeling by Avi DouglenDevSecCon Tel Aviv 2018 - Value driven threat modeling by Avi Douglen
DevSecCon Tel Aviv 2018 - Value driven threat modeling by Avi Douglen
 
Blast Radius
Blast RadiusBlast Radius
Blast Radius
 
Expanding Your .NET Testing Toolbox - GLUG NET
Expanding Your .NET Testing Toolbox - GLUG NETExpanding Your .NET Testing Toolbox - GLUG NET
Expanding Your .NET Testing Toolbox - GLUG NET
 
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
 
Tracking your Technical Debt with Sonarqube
Tracking your Technical Debt with SonarqubeTracking your Technical Debt with Sonarqube
Tracking your Technical Debt with Sonarqube
 
Robot Framework Introduction & Sauce Labs Integration
Robot Framework Introduction & Sauce Labs IntegrationRobot Framework Introduction & Sauce Labs Integration
Robot Framework Introduction & Sauce Labs Integration
 
DevSecCon London 2017: Shift happens ... by Colin Domoney
DevSecCon London 2017: Shift happens ... by Colin Domoney DevSecCon London 2017: Shift happens ... by Colin Domoney
DevSecCon London 2017: Shift happens ... by Colin Domoney
 
Sec4dev 2021 - Catch Me If You can : Continuous Delivery vs. Security Assurance
Sec4dev 2021  - Catch Me If You can : Continuous Delivery vs. Security AssuranceSec4dev 2021  - Catch Me If You can : Continuous Delivery vs. Security Assurance
Sec4dev 2021 - Catch Me If You can : Continuous Delivery vs. Security Assurance
 

Viewers also liked

Salesforce certification a developer journey
Salesforce certification a developer journeySalesforce certification a developer journey
Salesforce certification a developer journey
Christopher Lewis
 
Cuestionario de valoracion de proyectos mecanismos
Cuestionario de valoracion de proyectos mecanismosCuestionario de valoracion de proyectos mecanismos
Cuestionario de valoracion de proyectos mecanismosfcpmartin
 
Spring’16 Developer Highlights
Spring’16 Developer HighlightsSpring’16 Developer Highlights
Spring’16 Developer Highlights
Simon Lawrence
 
How to upload to slideshare and embed in blogger
How to upload to slideshare and embed in bloggerHow to upload to slideshare and embed in blogger
How to upload to slideshare and embed in bloggerDaybird1987
 
How To Add Power Point Presentations To Blogger
How To Add  Power Point Presentations To BloggerHow To Add  Power Point Presentations To Blogger
How To Add Power Point Presentations To Bloggerguest66ae43
 
How To Embed SlideShare Shows Into WordPress.com
How To Embed SlideShare Shows Into WordPress.comHow To Embed SlideShare Shows Into WordPress.com
How To Embed SlideShare Shows Into WordPress.comKathy Gill
 
Spring '16 Lightning Experience Features
Spring '16 Lightning Experience FeaturesSpring '16 Lightning Experience Features
Spring '16 Lightning Experience Features
Christopher Lewis
 

Viewers also liked (7)

Salesforce certification a developer journey
Salesforce certification a developer journeySalesforce certification a developer journey
Salesforce certification a developer journey
 
Cuestionario de valoracion de proyectos mecanismos
Cuestionario de valoracion de proyectos mecanismosCuestionario de valoracion de proyectos mecanismos
Cuestionario de valoracion de proyectos mecanismos
 
Spring’16 Developer Highlights
Spring’16 Developer HighlightsSpring’16 Developer Highlights
Spring’16 Developer Highlights
 
How to upload to slideshare and embed in blogger
How to upload to slideshare and embed in bloggerHow to upload to slideshare and embed in blogger
How to upload to slideshare and embed in blogger
 
How To Add Power Point Presentations To Blogger
How To Add  Power Point Presentations To BloggerHow To Add  Power Point Presentations To Blogger
How To Add Power Point Presentations To Blogger
 
How To Embed SlideShare Shows Into WordPress.com
How To Embed SlideShare Shows Into WordPress.comHow To Embed SlideShare Shows Into WordPress.com
How To Embed SlideShare Shows Into WordPress.com
 
Spring '16 Lightning Experience Features
Spring '16 Lightning Experience FeaturesSpring '16 Lightning Experience Features
Spring '16 Lightning Experience Features
 

Similar to Testing From The Trenches - Salesforce1 World Tour 2014

Unit testing in Force.com platform
Unit testing in Force.com platformUnit testing in Force.com platform
Unit testing in Force.com platform
Chamil Madusanka
 
Code coverage
Code coverageCode coverage
Code coverage
Return on Intelligence
 
Continuous Integration Testing for SAP
Continuous Integration Testing for SAPContinuous Integration Testing for SAP
Continuous Integration Testing for SAP
Worksoft
 
How to Test PowerShell Code Using Pester
How to Test PowerShell Code Using PesterHow to Test PowerShell Code Using Pester
How to Test PowerShell Code Using Pester
Chris Wahl
 
Episode 5 - Writing unit tests in Salesforce
Episode 5 - Writing unit tests in SalesforceEpisode 5 - Writing unit tests in Salesforce
Episode 5 - Writing unit tests in Salesforce
Jitendra Zaa
 
SecDevOps: The New Black of IT
SecDevOps: The New Black of ITSecDevOps: The New Black of IT
SecDevOps: The New Black of IT
CloudPassage
 
Developer + tester = quality++
Developer + tester = quality++Developer + tester = quality++
Developer + tester = quality++
Mikalai Alimenkou
 
SOFTWARE TESTING W1_watermark.pdf
SOFTWARE TESTING W1_watermark.pdfSOFTWARE TESTING W1_watermark.pdf
SOFTWARE TESTING W1_watermark.pdf
ShubhamSingh606946
 
Dev ops ci-ap-is-oh-my_security-gone-agile_ut-austin
Dev ops ci-ap-is-oh-my_security-gone-agile_ut-austinDev ops ci-ap-is-oh-my_security-gone-agile_ut-austin
Dev ops ci-ap-is-oh-my_security-gone-agile_ut-austin
Matt Tesauro
 
Five Enterprise Best Practices That EVERY Salesforce Org Can Use (DF15 Session)
Five Enterprise Best Practices That EVERY Salesforce Org Can Use (DF15 Session)Five Enterprise Best Practices That EVERY Salesforce Org Can Use (DF15 Session)
Five Enterprise Best Practices That EVERY Salesforce Org Can Use (DF15 Session)
Vivek Chawla
 
Five Enterprise Development Best Practices That EVERY Salesforce Org Can Use
Five Enterprise Development Best Practices That EVERY Salesforce Org Can UseFive Enterprise Development Best Practices That EVERY Salesforce Org Can Use
Five Enterprise Development Best Practices That EVERY Salesforce Org Can Use
Salesforce Developers
 
Unit Testing Best Practices
Unit Testing Best PracticesUnit Testing Best Practices
Unit Testing Best PracticesTomaš Maconko
 
Awesome Test Automation Made Simple w/ Dave Haeffner
Awesome Test Automation Made Simple w/ Dave HaeffnerAwesome Test Automation Made Simple w/ Dave Haeffner
Awesome Test Automation Made Simple w/ Dave Haeffner
Sauce Labs
 
Part of the DLM story: Get your Database under Source Control - SQL In The City
Part of the DLM story: Get your Database under Source Control - SQL In The City Part of the DLM story: Get your Database under Source Control - SQL In The City
Part of the DLM story: Get your Database under Source Control - SQL In The City
Red Gate Software
 
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald BelchamGetting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
.NET Conf UY
 
Testing with laravel
Testing with laravelTesting with laravel
Testing with laravel
Derek Binkley
 
Tdd using Jasmine and karma
Tdd using  Jasmine and karmaTdd using  Jasmine and karma
Tdd using Jasmine and karma
Siddharth Mishra
 
Exception handling
Exception handlingException handling
Exception handling
pooja kumari
 
Database Unit Testing Made Easy with VSTS
Database Unit Testing Made Easy with VSTSDatabase Unit Testing Made Easy with VSTS
Database Unit Testing Made Easy with VSTS
Sanil Mhatre
 
Automation Best Practices
Automation Best PracticesAutomation Best Practices
Automation Best Practices
Sauce Labs
 

Similar to Testing From The Trenches - Salesforce1 World Tour 2014 (20)

Unit testing in Force.com platform
Unit testing in Force.com platformUnit testing in Force.com platform
Unit testing in Force.com platform
 
Code coverage
Code coverageCode coverage
Code coverage
 
Continuous Integration Testing for SAP
Continuous Integration Testing for SAPContinuous Integration Testing for SAP
Continuous Integration Testing for SAP
 
How to Test PowerShell Code Using Pester
How to Test PowerShell Code Using PesterHow to Test PowerShell Code Using Pester
How to Test PowerShell Code Using Pester
 
Episode 5 - Writing unit tests in Salesforce
Episode 5 - Writing unit tests in SalesforceEpisode 5 - Writing unit tests in Salesforce
Episode 5 - Writing unit tests in Salesforce
 
SecDevOps: The New Black of IT
SecDevOps: The New Black of ITSecDevOps: The New Black of IT
SecDevOps: The New Black of IT
 
Developer + tester = quality++
Developer + tester = quality++Developer + tester = quality++
Developer + tester = quality++
 
SOFTWARE TESTING W1_watermark.pdf
SOFTWARE TESTING W1_watermark.pdfSOFTWARE TESTING W1_watermark.pdf
SOFTWARE TESTING W1_watermark.pdf
 
Dev ops ci-ap-is-oh-my_security-gone-agile_ut-austin
Dev ops ci-ap-is-oh-my_security-gone-agile_ut-austinDev ops ci-ap-is-oh-my_security-gone-agile_ut-austin
Dev ops ci-ap-is-oh-my_security-gone-agile_ut-austin
 
Five Enterprise Best Practices That EVERY Salesforce Org Can Use (DF15 Session)
Five Enterprise Best Practices That EVERY Salesforce Org Can Use (DF15 Session)Five Enterprise Best Practices That EVERY Salesforce Org Can Use (DF15 Session)
Five Enterprise Best Practices That EVERY Salesforce Org Can Use (DF15 Session)
 
Five Enterprise Development Best Practices That EVERY Salesforce Org Can Use
Five Enterprise Development Best Practices That EVERY Salesforce Org Can UseFive Enterprise Development Best Practices That EVERY Salesforce Org Can Use
Five Enterprise Development Best Practices That EVERY Salesforce Org Can Use
 
Unit Testing Best Practices
Unit Testing Best PracticesUnit Testing Best Practices
Unit Testing Best Practices
 
Awesome Test Automation Made Simple w/ Dave Haeffner
Awesome Test Automation Made Simple w/ Dave HaeffnerAwesome Test Automation Made Simple w/ Dave Haeffner
Awesome Test Automation Made Simple w/ Dave Haeffner
 
Part of the DLM story: Get your Database under Source Control - SQL In The City
Part of the DLM story: Get your Database under Source Control - SQL In The City Part of the DLM story: Get your Database under Source Control - SQL In The City
Part of the DLM story: Get your Database under Source Control - SQL In The City
 
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald BelchamGetting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
 
Testing with laravel
Testing with laravelTesting with laravel
Testing with laravel
 
Tdd using Jasmine and karma
Tdd using  Jasmine and karmaTdd using  Jasmine and karma
Tdd using Jasmine and karma
 
Exception handling
Exception handlingException handling
Exception handling
 
Database Unit Testing Made Easy with VSTS
Database Unit Testing Made Easy with VSTSDatabase Unit Testing Made Easy with VSTS
Database Unit Testing Made Easy with VSTS
 
Automation Best Practices
Automation Best PracticesAutomation Best Practices
Automation Best Practices
 

Recently uploaded

FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 

Testing From The Trenches - Salesforce1 World Tour 2014

  • 1. Testing From The Trenches May 22nd, 2014
  • 2. Christopher Alun Lewis Advanced Developer Force.com MVP A Developers Perspective Simon Lawrence Certified Developer Force.com MVP http://www.slideshare.net/SimonLawrence4
  • 3. Why Do We Test? • Testing is required by Salesforce.com to release code to production environments • Regression Protection Against Future Changes • Salesforce make 3 Platform Releases a Year • Residing in a Multi-Tenancy Environment • To Rid Your Systems of Bugs
  • 4. Testing on Salesforce Our 5 Top Tips for Testing
  • 5. #1 Always Include Assertions • These are what we call “Skeleton Tests” • Other than avoiding exceptions, provide almost no use • Missing a great opportunity to provide feedback on future failure scenarios
  • 6. #1 Always Include Assertions The Code
  • 7. #1 Always Include Assertions The Criminal Test
  • 8. #1 Always Include Assertions The Correct Test
  • 9. #2 Remember your Batch Scenarios • Your code may need to process large collections objects, ensure that your tests cover this • A serious consideration for testing your system’s ability to operate within the governor limits
  • 10. #2 Remember your Batch Scenarios The Code
  • 11. #2 Remember your Batch Scenarios The Criminal Test
  • 12. #2 Remember your Batch Scenarios The Correct Test
  • 13. #3 Test Roles with RunAs • Test execution defaults to running as System Admin • Using RunAs allows you to test your sharing rules and record access rights
  • 14. #3 Test Roles with RunAs
  • 15. #3 Test Roles with RunAs The Correct Test
  • 16. #4 Test Every Branch of Logic • Making sure test cases traverse every possible logical route through your code • Crucial pieces of logic can be hidden in IF/ELSE blocks
  • 17. #4 Test Every Branch of Logic The Code
  • 18. #4 Test Every Branch of Logic The Criminal Test
  • 19. #4 Test Every Branch of Logic The Coverage
  • 20. #4 Test Every Branch of Logic The Correct Test
  • 21. #5 The 75% Squad • Those developers who just strive to get to the 75% mark • Normally guilty of most of the other crimes • There’s no future for their code and their work
  • 22. #5 The 75% Squad The Code
  • 23. #5 The 75% Squad The Criminal Test
  • 24. #5 The 75% Squad The Coverage
  • 25. The Wrap Up • Always have test Assertions • Batch test your Triggers • RunAs different Users in your tests • Cover every branch of your logical flow • Don’t just aim for 75%
  • 26. Resources • These Slides http://www.slideshare.net/SimonLawrence4 • Developer Resources https://developer.salesforce.com https://developer.salesforce.com/page/How_to_Write_Good_Unit_Tests • Salesforce Stack Exchange http://salesforce.stackexchange.com/
  • 27. Thank You! Christopher Alun Lewis @ChrisAlunLewis Simon Lawrence @srlawr

Editor's Notes

  1. Prefrerredtowritimgimmovativenewcode---no!!
  2. Prefrerredtowritimgimmovativenewcode---no!!
  3. A really simple calculator class with one method that by its definition one would assume provides the sum of two numbers Takes two parameters, it’s called “Sum” However, bit of a developer problem, it always returns 42
  4. Here is our test method to see if our Sum function works We pass two pairs of numbers i This test passes, and we have 100% code coverage
  5. Here is our test method to see if our Sum function works We pass two pairs of numbers i This test passes, and we have 100% code coverage
  6. No control over how many records Salesforce might send to a trigger Helps detect limit exceptions, but also race conditions and deadlocks Inefficient code can cause transactions to roll back repeatedly blocking functionality The primary example is triggers, but we also need to mention there can be controller code that has to deal with this
  7. Here is our example, a really simple trigger that when a contact is inserted if it’s parent account doesn’t have a phone number, the contact number is copied into that record and saved Now this code is probably going to get you into trouble in a production environment… No concept of batchification … who can spot what governor limit you are at risk of breaking here (SOQL first – 100, and then DML -150)
  8. Here is our test (explain code: create data, startTest stopTest, reload accounts, assert value copy) This test will run our trigger and it will pass, and even give you 100% coverage That is no good though, because in live, our trigger will very likely fail due to limit exceptions
  9. We have introduced a loop which will test our trigger in a scenario of 200 contacts being added This will now throw the limit exception and force us to correct our code before deployment
  10. Complicated custom controllers We spend a lot of time on role hierarchies and record sharing, so why do we so often neglect to test it
  11. Here’s a pretty standard, and very simple Sales Team set up Now imagine you had a strict requirement that the members of the Sales Team could NOT see each others opportunities – for competitive purposes This is easy enough to implement and manually test, but how can you be sure such sharing rules are consistently implemented, and never accidently invalidated or overridden? You’d want a test case for it – important thing to remember to test, but so rarely addressed
  12. Load profile Load role Create two users
  13. Another small snippet of code, a simple function that manages a division scenario This time a significant mathematical flaw at line 10 in which we divide by zero
  14. This accompanying test class has two methods to test this class, sending a positive and a negative value to our method. It passes just fine, and even achieves 85% test coverage, so we might think we are all good to go But lets see what the result of running this test is on the class
  15. The handy code coverage indicator tells us exactly what lines are not covered, and it’s line 10.. Whilst we might think we are good to release here, we need to examine the uncovered lines, consider what test conditions will cover it, and test it accordingly Otherwise we are going to end up having problems down the line
  16. The handy code coverage indicator tells us exactly what lines are not covered, and it’s line 10.. Whilst we might think we are good to release here, we need to examine the uncovered lines, consider what test conditions will cover it, and test it accordingly Otherwise we are going to end up having problems down the line
  17. Our final criminal act is something we call the 75% Squad Not focussed on testing, just on getting to 75%
  18. Here are four simple mathematical methods Provide 9 lines of testable code Therefore we need to cover 7 of them to be hit the “release point” of 75%
  19. Here is our simple test case thrown together (No asserts) It Tests a few methods and it passes no problem Lets look at the results
  20. So the coverage is 77% (above 75%) - we can release Using the handy code coverage indicator in the Developer Console again See some code that is not tested, but will be released with the rest of it The 75% mark is not Salesforce just saying you can skip the last 25% of your tests. It’s to allow realistic coverage targets. You’re not aiming for 75%, your aiming for complete test scenario coverage – and that will *get* you past 75%. There is NO reason not to test this method – unless you are blinded by that 75%