SlideShare uma empresa Scribd 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

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Semelhante a 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
 

Semelhante a 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
 

Mais de 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
 

Mais de 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
 

Último

Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
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
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
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
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
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
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
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
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Jeffrey Haguewood
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
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
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 

Último (20)

Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
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
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
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
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
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
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
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
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
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
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 

Apex Testing Deep Dive

Notas do Editor

  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