SlideShare ist ein Scribd-Unternehmen logo
#SalesforceApexHourswww.ApexHours.com
Salesforce Apex Hours
Farmington Hill Salesforce Developer Group
Apex Testing Deep Dive
#SalesforceApexHours
#SalesforceApexHours
Speaker
Date
Venue/Link
Adam Olshansky
Saturday, JUN 6, 2020 10:00 AM EST ( 8:30 PM IST )
Online
www.apexhours.com
#SalesforceApexHourswww.ApexHours.com
Who I am
Amit Chaudhary (Salesforce MVP)
• Active on Salesforce Developer Community
• Blogging at http://amitsalesforce.blogspot.in/
• Co-Organizer of – FarmingtonHillsSFDCDug
• Founder of www.ApexHours.com
• Follow us @Amit_SFDC or @ApexHours
#SalesforceApexHourswww.ApexHours.com
Our Speaker
Adam Olshansky
• Salesforce MVP, Salesforce Engineer,
630 14X
• @adam17amo
• AdamToArchitect.com
• bit.ly/lightningmigration
#SalesforceApexHourswww.ApexHours.com
Agenda
• Intro to Testing
• Testing Basics
• Types of Tests
• Test Apex Class/Async
• Testing Callouts
• Debugging Failed Tests
• Recap
#SalesforceApexHourswww.ApexHours.com
Intro to Testing
#SalesforceApexHourswww.ApexHours.com
Why Test?
• Ensure code is working
• 75% Code Coverage Required for Production
• Catch bugs early
• Prevent Regression
#SalesforceApexHourswww.ApexHours.com
Structure of a Test
• Create Test Data
• Run Code
• Assert Results
#SalesforceApexHourswww.ApexHours.com
How to Create Test Data
• Manually create it for each test
• Load data via CSV Static Resource
• Test Setup
• Test Factory
#SalesforceApexHourswww.ApexHours.com
Code: Intro to Testing
#SalesforceApexHourswww.ApexHours.com
Manually Create
#SalesforceApexHourswww.ApexHours.com
Load Via CSV
#SalesforceApexHourswww.ApexHours.com
Load Via CSV
#SalesforceApexHourswww.ApexHours.com
Test Setup
#SalesforceApexHourswww.ApexHours.com
Test Setup
#SalesforceApexHourswww.ApexHours.com
DEMO: Test Factory
• What happens to all our tests when a new field is required?
• How many places do we have to make updates?
#SalesforceApexHourswww.ApexHours.com
Test Factory
#SalesforceApexHourswww.ApexHours.com
Test Factory
#SalesforceApexHourswww.ApexHours.com
Test Setup with Test Factory
#SalesforceApexHourswww.ApexHours.com
How to Create Test Data
• Manually create it for each test
• Pro: Variables in context
• Con: Lots of duplicate code
• Load data via CSV Static Resource
• Pro: Don’t need to make code updates for record creation
• Con: Might be harder to track changes to static resources
• Test Setup
• Pro: Reduce repetitive code
• Con: Variables out of context
• Test Factory
• Pro: Single location to update schema in code
• Con: Variables out of context
#SalesforceApexHourswww.ApexHours.com
Testing Basics
#SalesforceApexHourswww.ApexHours.com
Asserts in Tests
• Confirm that code works as you expect it to
• System.assert(condition, msg)
• System.assertEquals(expected, actual, msg)
• System.assertNotEquals(expected, actual, msg)
• What controls whether or not your tests pass
#SalesforceApexHourswww.ApexHours.com
Code Coverage
• Controls whether code can go to production
• Calculated by tests running through your code
• Triggers automatically fired
• Classes and methods called manually or via code
#SalesforceApexHourswww.ApexHours.com
Tips to Increase Test Coverage
• @TestVisible
• Test.isRunningTest()
• Test Driven Development (TDD)
#SalesforceApexHourswww.ApexHours.com
Bad Habits for Tests
DON’T DO THIS
• No asserts in your tests
• Asserts that don’t cover the part that
was tested
• Fake code in your classes
#SalesforceApexHourswww.ApexHours.com
Test Suites
• Collection of tests
• Useful to cover entire application
• Help unrelated prevent regressions
#SalesforceApexHourswww.ApexHours.com
Different Types of Testing
• Unit Tests
• End to End Tests
• Integration Tests
• User Acceptance Tests
#SalesforceApexHourswww.ApexHours.com
DEMO: Asserts and Coverage
#SalesforceApexHourswww.ApexHours.com
Types of Tests
#SalesforceApexHourswww.ApexHours.com
Positive vs. Negative Tests
• Positive
• Confirm expected cases
• Test code works when users
behave as expected
• Negative
• Test unexpected cases
• Test bad inputs
• Test boundary conditions
#SalesforceApexHourswww.ApexHours.com
System.runAs()
• Code needs to be tested as different users
• Create/find a user and test on their behalf
• Only applies to sharing, not FLS
• Useful for avoiding Mixed DML errors
• Useful for testing a specific version of managed package
#SalesforceApexHourswww.ApexHours.com
DEMO: Test Types and System.RunAs
#SalesforceApexHourswww.ApexHours.com
Code
#SalesforceApexHourswww.ApexHours.com
Test Apex Class
#SalesforceApexHourswww.ApexHours.com
Avoiding Limits in Tests
• Test.startTest() and Test.stopTest()
• Bulkifying record creation
• Creating records without DML
• Split up tests by use case
• Test.isRunningTest()
#SalesforceApexHourswww.ApexHours.com
Asynchronous Testing
• @future
• Batchable
• Queueable
• Schedulable
• Will only schedule but won’t run the job
• Runs on Test.stopTest()
• Verify it properly ran
• Verify results
#SalesforceApexHourswww.ApexHours.com
Other Test Class Uses
• Test.isRunningTest()
• Test.setCreatedDate()
• Test.setCurrentPage()
#SalesforceApexHourswww.ApexHours.com
DEMO: Test Class
#SalesforceApexHourswww.ApexHours.com
CaseReassignmentBatch
• Take all cases owned by the Temp Queue
• Assign them to specified user
#SalesforceApexHourswww.ApexHours.com
Testing Callouts
#SalesforceApexHourswww.ApexHours.com
Mock Tests
• Can’t make callouts in Apex tests
• Mock responses
• Test.setMock()
#SalesforceApexHourswww.ApexHours.com
Generating Mock Data
• Model after actual API responses
• Test for multiple response codes
• 200
• 403
• 500
• Create map to hold multiple responses
#SalesforceApexHourswww.ApexHours.com
DEMO: Mock Testing
• Custom Object: Purchase Order
• External System to sync data back to Salesforce based on external Id
• Need to handle different responses from API
#SalesforceApexHourswww.ApexHours.com
Code
#SalesforceApexHourswww.ApexHours.com
Code
#SalesforceApexHourswww.ApexHours.com
Different Ways to Mock
• Constructor
• Static Resource
• Map
#SalesforceApexHourswww.ApexHours.com
Debugging Tests
#SalesforceApexHourswww.ApexHours.com
Debug Failing Tests
• Sanity check data after @testSetup
• Compare before/after values rather than hardcoding
• Include try/catches
• System.debug is your friend
#SalesforceApexHourswww.ApexHours.com
Apex Replay Debugger
• Set unlimited breakpoints
• Set up to 5 checkpoints
• Replay your failed tests step by step and find errors
#SalesforceApexHourswww.ApexHours.com
DEMO: Debugging Testing
#SalesforceApexHourswww.ApexHours.com
Recap
#SalesforceApexHourswww.ApexHours.com
Summary
• Why We Test
• Types of Tests
• “Test” Class and Async Testing
• Mock Tests for Callouts
• Apex Replay Debugger
#SalesforceApexHourswww.ApexHours.com
What’s Next?
• Lightning Component Tests
• force:lightning:lwc:test:create
• force:lightning:lwc:test:run
• force:lightning:lwc:test:setup
#SalesforceApexHourswww.ApexHours.com
Follow us
#SalesforceApexHours @ApexHours
@adam17amo
www.ApexHours.com
https://trailblazercommunitygroups.com/farmington
-mi-developers-group/
Bit.ly/ApexHours
AdamToArchitect.com
Github.com/adam17amo/apextesting

Weitere ähnliche Inhalte

Was ist angesagt?

Testable requirements
Testable requirementsTestable requirements
Testable requirements
Wyn B. Van Devanter
 
Automated tests to a REST API
Automated tests to a REST APIAutomated tests to a REST API
Automated tests to a REST API
Luís Barros Nóbrega
 
Automated Acceptance Test Practices and Pitfalls
Automated Acceptance Test Practices and PitfallsAutomated Acceptance Test Practices and Pitfalls
Automated Acceptance Test Practices and Pitfalls
Wyn B. Van Devanter
 
Apex 10 commandments df14
Apex 10 commandments df14Apex 10 commandments df14
Apex 10 commandments df14
James Loghry
 
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
 
Test Automation and Innovation with Open Source Tools
Test Automation and Innovation with Open Source ToolsTest Automation and Innovation with Open Source Tools
Test Automation and Innovation with Open Source Tools
Michael Palotas
 
Apex trigger framework Salesforce #ApexTrigger #Salesforce #SFDCPanther
Apex trigger framework Salesforce #ApexTrigger #Salesforce #SFDCPantherApex trigger framework Salesforce #ApexTrigger #Salesforce #SFDCPanther
Apex trigger framework Salesforce #ApexTrigger #Salesforce #SFDCPanther
Amit Singh
 
API Testing with Frisby and Mocha
API Testing with Frisby and MochaAPI Testing with Frisby and Mocha
API Testing with Frisby and Mocha
Lyudmila Anisimova
 
Reducing False Positives In Automated Testing
Reducing False Positives In Automated TestingReducing False Positives In Automated Testing
Reducing False Positives In Automated Testing
QASource
 
Apex Trigger Debugging: Solving the Hard Problems
Apex Trigger Debugging: Solving the Hard ProblemsApex Trigger Debugging: Solving the Hard Problems
Apex Trigger Debugging: Solving the Hard Problems
Salesforce Developers
 
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
 
From 0 to 100: How we jump-started our frontend testing
From 0 to 100: How we jump-started our frontend testingFrom 0 to 100: How we jump-started our frontend testing
From 0 to 100: How we jump-started our frontend testing
Henning Muszynski
 
Salesforce asynchronous apex
Salesforce asynchronous apexSalesforce asynchronous apex
Salesforce asynchronous apex
Badan Singh Pundeer
 
Automated Software Testing
Automated Software TestingAutomated Software Testing
Automated Software Testing
arild2
 
REST API testing with SpecFlow
REST API testing with SpecFlowREST API testing with SpecFlow
REST API testing with SpecFlow
Aiste Stikliute
 
Getting started with Appium 2.0
Getting started with Appium 2.0Getting started with Appium 2.0
Getting started with Appium 2.0
Anand Bagmar
 
Cypress - Best Practices
Cypress - Best PracticesCypress - Best Practices
Cypress - Best Practices
Brian Mann
 
Your Tests Are Not Your Specs
Your Tests Are Not Your SpecsYour Tests Are Not Your Specs
Your Tests Are Not Your Specs
Hillel Wayne
 
Easy Automated UI Testing with Canopy
Easy Automated UI Testing with CanopyEasy Automated UI Testing with Canopy
Easy Automated UI Testing with Canopy
Eric Potter
 
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
 

Was ist angesagt? (20)

Testable requirements
Testable requirementsTestable requirements
Testable requirements
 
Automated tests to a REST API
Automated tests to a REST APIAutomated tests to a REST API
Automated tests to a REST API
 
Automated Acceptance Test Practices and Pitfalls
Automated Acceptance Test Practices and PitfallsAutomated Acceptance Test Practices and Pitfalls
Automated Acceptance Test Practices and Pitfalls
 
Apex 10 commandments df14
Apex 10 commandments df14Apex 10 commandments df14
Apex 10 commandments df14
 
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
 
Test Automation and Innovation with Open Source Tools
Test Automation and Innovation with Open Source ToolsTest Automation and Innovation with Open Source Tools
Test Automation and Innovation with Open Source Tools
 
Apex trigger framework Salesforce #ApexTrigger #Salesforce #SFDCPanther
Apex trigger framework Salesforce #ApexTrigger #Salesforce #SFDCPantherApex trigger framework Salesforce #ApexTrigger #Salesforce #SFDCPanther
Apex trigger framework Salesforce #ApexTrigger #Salesforce #SFDCPanther
 
API Testing with Frisby and Mocha
API Testing with Frisby and MochaAPI Testing with Frisby and Mocha
API Testing with Frisby and Mocha
 
Reducing False Positives In Automated Testing
Reducing False Positives In Automated TestingReducing False Positives In Automated Testing
Reducing False Positives In Automated Testing
 
Apex Trigger Debugging: Solving the Hard Problems
Apex Trigger Debugging: Solving the Hard ProblemsApex Trigger Debugging: Solving the Hard Problems
Apex Trigger Debugging: Solving the Hard Problems
 
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
 
From 0 to 100: How we jump-started our frontend testing
From 0 to 100: How we jump-started our frontend testingFrom 0 to 100: How we jump-started our frontend testing
From 0 to 100: How we jump-started our frontend testing
 
Salesforce asynchronous apex
Salesforce asynchronous apexSalesforce asynchronous apex
Salesforce asynchronous apex
 
Automated Software Testing
Automated Software TestingAutomated Software Testing
Automated Software Testing
 
REST API testing with SpecFlow
REST API testing with SpecFlowREST API testing with SpecFlow
REST API testing with SpecFlow
 
Getting started with Appium 2.0
Getting started with Appium 2.0Getting started with Appium 2.0
Getting started with Appium 2.0
 
Cypress - Best Practices
Cypress - Best PracticesCypress - Best Practices
Cypress - Best Practices
 
Your Tests Are Not Your Specs
Your Tests Are Not Your SpecsYour Tests Are Not Your Specs
Your Tests Are Not Your Specs
 
Easy Automated UI Testing with Canopy
Easy Automated UI Testing with CanopyEasy Automated UI Testing with Canopy
Easy Automated UI Testing with Canopy
 
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
 

Ähnlich wie Apex Testing Deep Dive

Level Up Your Salesforce Unit Testing
Level Up Your Salesforce Unit TestingLevel Up Your Salesforce Unit Testing
Level Up Your Salesforce Unit Testing
Gordon Bockus
 
6 Traits of a Successful Test Automation Architecture
6 Traits of a Successful Test Automation Architecture6 Traits of a Successful Test Automation Architecture
6 Traits of a Successful Test Automation Architecture
Erdem YILDIRIM
 
Apex code Benchmarking
Apex code BenchmarkingApex code Benchmarking
Apex code Benchmarking
Amit Chaudhary
 
MidwestJS Zero to Testing
MidwestJS Zero to TestingMidwestJS Zero to Testing
MidwestJS Zero to Testing
pamselle
 
Platform cache
Platform cachePlatform cache
Platform cache
Amit Chaudhary
 
Continuous Delivery - Automate & Build Better Software with Travis CI
Continuous Delivery - Automate & Build Better Software with Travis CIContinuous Delivery - Automate & Build Better Software with Travis CI
Continuous Delivery - Automate & Build Better Software with Travis CI
wajrcs
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium Successfully
Dave Haeffner
 
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
 
A Beginer's Guide to testing in Django
A Beginer's Guide to testing in DjangoA Beginer's Guide to testing in Django
A Beginer's Guide to testing in Django
Psalms Kalu
 
Testing sync engine
Testing sync engineTesting sync engine
Testing sync engine
Ilya Puchka
 
Continuous Delivery & Testing Madrid AfterTest
Continuous Delivery & Testing Madrid AfterTestContinuous Delivery & Testing Madrid AfterTest
Continuous Delivery & Testing Madrid AfterTest
Peter Marshall
 
QuerySurge for DevOps
QuerySurge for DevOpsQuerySurge for DevOps
QuerySurge for DevOps
RTTS
 
Developer testing 101: Become a Testing Fanatic
Developer testing 101: Become a Testing FanaticDeveloper testing 101: Become a Testing Fanatic
Developer testing 101: Become a Testing Fanatic
LB Denker
 
CLEDevs All about Tests
CLEDevs All about TestsCLEDevs All about Tests
CLEDevs All about Tests
Lynda Kane
 
Test driven APIs with Laravel
Test driven APIs with LaravelTest driven APIs with Laravel
Test driven APIs with Laravel
Michael Peacock
 
Beginners overview of automated testing with Rspec
Beginners overview of automated testing with RspecBeginners overview of automated testing with Rspec
Beginners overview of automated testing with Rspec
jeffrey1ross
 
Jumpstarting Testing In Your Organization with Selenium, Cucumber, & WebdriverIO
Jumpstarting Testing In Your Organization with Selenium, Cucumber, & WebdriverIOJumpstarting Testing In Your Organization with Selenium, Cucumber, & WebdriverIO
Jumpstarting Testing In Your Organization with Selenium, Cucumber, & WebdriverIO
Josh Cypher
 
Unit Testing Best Practices
Unit Testing Best PracticesUnit Testing Best Practices
Unit Testing Best Practices
Tomaš Maconko
 
Integration Testing in Python
Integration Testing in PythonIntegration Testing in Python
Integration Testing in Python
Panoptic Development, Inc.
 
Coding Apps in the Cloud with Force.com - Part I
Coding Apps in the Cloud with Force.com - Part ICoding Apps in the Cloud with Force.com - Part I
Coding Apps in the Cloud with Force.com - Part I
Salesforce Developers
 

Ähnlich wie Apex Testing Deep Dive (20)

Level Up Your Salesforce Unit Testing
Level Up Your Salesforce Unit TestingLevel Up Your Salesforce Unit Testing
Level Up Your Salesforce Unit Testing
 
6 Traits of a Successful Test Automation Architecture
6 Traits of a Successful Test Automation Architecture6 Traits of a Successful Test Automation Architecture
6 Traits of a Successful Test Automation Architecture
 
Apex code Benchmarking
Apex code BenchmarkingApex code Benchmarking
Apex code Benchmarking
 
MidwestJS Zero to Testing
MidwestJS Zero to TestingMidwestJS Zero to Testing
MidwestJS Zero to Testing
 
Platform cache
Platform cachePlatform cache
Platform cache
 
Continuous Delivery - Automate & Build Better Software with Travis CI
Continuous Delivery - Automate & Build Better Software with Travis CIContinuous Delivery - Automate & Build Better Software with Travis CI
Continuous Delivery - Automate & Build Better Software with Travis CI
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium Successfully
 
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
 
A Beginer's Guide to testing in Django
A Beginer's Guide to testing in DjangoA Beginer's Guide to testing in Django
A Beginer's Guide to testing in Django
 
Testing sync engine
Testing sync engineTesting sync engine
Testing sync engine
 
Continuous Delivery & Testing Madrid AfterTest
Continuous Delivery & Testing Madrid AfterTestContinuous Delivery & Testing Madrid AfterTest
Continuous Delivery & Testing Madrid AfterTest
 
QuerySurge for DevOps
QuerySurge for DevOpsQuerySurge for DevOps
QuerySurge for DevOps
 
Developer testing 101: Become a Testing Fanatic
Developer testing 101: Become a Testing FanaticDeveloper testing 101: Become a Testing Fanatic
Developer testing 101: Become a Testing Fanatic
 
CLEDevs All about Tests
CLEDevs All about TestsCLEDevs All about Tests
CLEDevs All about Tests
 
Test driven APIs with Laravel
Test driven APIs with LaravelTest driven APIs with Laravel
Test driven APIs with Laravel
 
Beginners overview of automated testing with Rspec
Beginners overview of automated testing with RspecBeginners overview of automated testing with Rspec
Beginners overview of automated testing with Rspec
 
Jumpstarting Testing In Your Organization with Selenium, Cucumber, & WebdriverIO
Jumpstarting Testing In Your Organization with Selenium, Cucumber, & WebdriverIOJumpstarting Testing In Your Organization with Selenium, Cucumber, & WebdriverIO
Jumpstarting Testing In Your Organization with Selenium, Cucumber, & WebdriverIO
 
Unit Testing Best Practices
Unit Testing Best PracticesUnit Testing Best Practices
Unit Testing Best Practices
 
Integration Testing in Python
Integration Testing in PythonIntegration Testing in Python
Integration Testing in Python
 
Coding Apps in the Cloud with Force.com - Part I
Coding Apps in the Cloud with Force.com - Part ICoding Apps in the Cloud with Force.com - Part I
Coding Apps in the Cloud with Force.com - Part I
 

Mehr von Adam Olshansky

Maximize Apex Performance with Platform Cache
Maximize Apex Performance with Platform CacheMaximize Apex Performance with Platform Cache
Maximize Apex Performance with Platform Cache
Adam Olshansky
 
Lightning Components 101: An Apex Developer's Guide
Lightning Components 101: An Apex Developer's GuideLightning Components 101: An Apex Developer's Guide
Lightning Components 101: An Apex Developer's Guide
Adam Olshansky
 
Demystifying Code for Admins: The Last Step to Apex
Demystifying Code for Admins: The Last Step to ApexDemystifying Code for Admins: The Last Step to Apex
Demystifying Code for Admins: The Last Step to Apex
Adam Olshansky
 
Force Academy LA Trigger Framework
Force Academy LA Trigger FrameworkForce Academy LA Trigger Framework
Force Academy LA Trigger Framework
Adam Olshansky
 
Write Generic Code with the Tooling API
Write Generic Code with the Tooling APIWrite Generic Code with the Tooling API
Write Generic Code with the Tooling API
Adam Olshansky
 
Blaze Your Trail
Blaze Your TrailBlaze Your Trail
Blaze Your Trail
Adam Olshansky
 
Punta Dreamin 17 Generic Apex and Tooling Api
Punta Dreamin 17 Generic Apex and Tooling ApiPunta Dreamin 17 Generic Apex and Tooling Api
Punta Dreamin 17 Generic Apex and Tooling Api
Adam Olshansky
 
Phx User Group Salesforce Connect
Phx User Group Salesforce ConnectPhx User Group Salesforce Connect
Phx User Group Salesforce Connect
Adam Olshansky
 

Mehr von Adam Olshansky (8)

Maximize Apex Performance with Platform Cache
Maximize Apex Performance with Platform CacheMaximize Apex Performance with Platform Cache
Maximize Apex Performance with Platform Cache
 
Lightning Components 101: An Apex Developer's Guide
Lightning Components 101: An Apex Developer's GuideLightning Components 101: An Apex Developer's Guide
Lightning Components 101: An Apex Developer's Guide
 
Demystifying Code for Admins: The Last Step to Apex
Demystifying Code for Admins: The Last Step to ApexDemystifying Code for Admins: The Last Step to Apex
Demystifying Code for Admins: The Last Step to Apex
 
Force Academy LA Trigger Framework
Force Academy LA Trigger FrameworkForce Academy LA Trigger Framework
Force Academy LA Trigger Framework
 
Write Generic Code with the Tooling API
Write Generic Code with the Tooling APIWrite Generic Code with the Tooling API
Write Generic Code with the Tooling API
 
Blaze Your Trail
Blaze Your TrailBlaze Your Trail
Blaze Your Trail
 
Punta Dreamin 17 Generic Apex and Tooling Api
Punta Dreamin 17 Generic Apex and Tooling ApiPunta Dreamin 17 Generic Apex and Tooling Api
Punta Dreamin 17 Generic Apex and Tooling Api
 
Phx User Group Salesforce Connect
Phx User Group Salesforce ConnectPhx User Group Salesforce Connect
Phx User Group Salesforce Connect
 

Kürzlich hochgeladen

Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
fredae14
 
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Jeffrey Haguewood
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
LucaBarbaro3
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
dbms calicut university B. sc Cs 4th sem.pdf
dbms  calicut university B. sc Cs 4th sem.pdfdbms  calicut university B. sc Cs 4th sem.pdf
dbms calicut university B. sc Cs 4th sem.pdf
Shinana2
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
Dinusha Kumarasiri
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024
Intelisync
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 

Kürzlich hochgeladen (20)

Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
 
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
dbms calicut university B. sc Cs 4th sem.pdf
dbms  calicut university B. sc Cs 4th sem.pdfdbms  calicut university B. sc Cs 4th sem.pdf
dbms calicut university B. sc Cs 4th sem.pdf
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 

Apex Testing Deep Dive

Hinweis der Redaktion

  1. ManualDataTest LoadDataTest TestSetupTest TestFactory TestFactoryTests
  2. Fix Apex Trigger
  3. AccountTrigger Enable System.asserts in TestFactoryTests TestVisible in OpportunityHandler Tests in OpportunityTests Show Code Coverage TestSuite Example
  4. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing_tools_runas.htm
  5. Demo Positive, Negative, System.runAs OpportunityHandler.cls TestingTypes.cls
  6. Test.startTest/stopTest Async Test.setCreatedDate CaseReassignmentBatch TestClassTests
  7. PurchaseOrderSync PurchaseOrderSyncTest PurchaseOrderMock https://developer.salesforce.com/blogs/developer-relations/2013/03/testing-apex-callouts-using-httpcalloutmock.html
  8. Create .vscode directory Run on side menu. Create launch.json file with config for Apex Replay Debugger Toggle Checkpoint Update Checkpoints in Org Turn On Apex Debug Log for Replay Debugger Run Code Get Apex Debug Log (can also get log from user, can download from .sfdx/tools/debug/logs) Right Click in log and select Launch Apex Replay Debugger with Current File Advance through code