SlideShare a Scribd company logo
1 of 27
Forward-Looking Statement
This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or
if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the
forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any
projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies
or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology
developments and customer contracts or use of our services.
The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for
our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of
growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed
and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand,
retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history
reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could
affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly
report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC
Filings section of the Investor Information section of our Web site.
Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and
may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are
currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
Statement under the Private Securities Litigation Reform Act of 1995
Agenda
Testing Environment
Writing Tests
Common Patterns & Tips
Testing Environment
A Distinct Environment for Unit Testing
Runtime environment = Salesforce Platform
Production org, sandbox, scratch org...
Jest
+ jest-lwc extension
ESLint
+ LWC rules
+ + +
Custom
dependencies
?
Unit Testing environment = Local machine
Optional
Running Local Tests
Standard JS testing
Flexible configuration and popular JS tools
No Platform access => testing in isolation
Tests must be saved in revision control
No code coverage requirement
Jest
One of the most popular JS testing frameworks (speed, features, doc…)
Works with vanilla JS and HTML (JSDOM)
Open Source from Facebook
Extensions for specific JS frameworks
Jest for Lightning Web Components: lwc-jest
Jest extension that brings LWC-specific testing features
● Base Lightning Component mocks
● @Wire mocking utility
ESLint and Lightning Web Components rules
Not required for testing but highly recommended
Linting utility for JS
Covers component code + test code
Test Environment Minimal Setup
Requirements: Node.js + Salesforce DX project
1) Run these commands:
2) Add test scripts to the Node project configuration:
npm init
npm install
npm install @salesforce/lwc-jest --save-dev
"scripts": {
"test:unit": "lwc-jest",
"test:unit:watch": "lwc-jest --watch",
"test:unit:coverage": "lwc-jest --coverage"
},
Writing Tests
Adding Tests for a Component
lwc
hello
__tests__
hello.tests.js
hello.html
hello.js
hello.js-meta.xml
describe('c-hello', () => {
afterEach(() => {
// TODO: cleanup after tests
});
it('displays greeting', () => {
// TODO: run test
});
});
Test File Structure
Test suite
Teardown instructions
(optional)
Test
A Refresher on the Testing Mindset
Given Prepare test
When Test behavior
Then Assert expected result
Given – Prepare Test
Most of the time: add component to the DOM + set public properties
const element = createElement('recipe-contact-tile', {
is: ContactTile
});
element.contact = CONTACT_INPUT;
document.body.appendChild(element);
When – Test Behavior
Execute the test (click a button, enter some text, call a wire…)
element.shadowRoot.querySelector('lightning-button’).click();
const inputEl = element.shadowRoot.querySelector('lightning-input');
inputEl.value = USER_INPUT;
inputEl.dispatchEvent(new CustomEvent('change'));
getContactListAdapter.emit(mockGetContactList);
Then – Assert Expected Result
Assertions written with a fluent syntax
expect(div.textContent).toBe(`Hello, ${EXPECTED}!`);
expect(errorPanelElement).not.toBeNull();
expect(mockSelectHandler).toHaveBeenCalledTimes(1);
Matchers
Common Patterns & Tips
Two Types of Tests
DOM inspection tests
• Covers <template>
• rendering logic
• events
• Needed but...
• no test coverage
• harder to maintain
Logic tests
• Covers JS logic, wire calls
• Test coverage
Naming Tests
Suite name describes unit under test
Test name describes scenario and expectation
// Unit under test
describe('c-apex-wire-method-to-property', () => {
describe('getContactList @wire data', () => {
// Expectation and scenario
it('renders no items when no records are available', () => {
});
});
});
Test Data
Use realistic input data
Use module level constants
Move test data sets to .json files
Focus on Back-Box Testing
Test public methods, templates and events first
No need to reach 100% code coverage
Conclusion
What we’ve covered
Local testing environment with Jest
How to write behavior-driven tests
Focusing on black-box testing
Next Steps
Add Prettier
Setup CI
Monitor code coverage evolution
Resources
Jest website jestjs.io
Sample App Gallery (Recipes in particular) trailhead.salesforce.com/sample-gallery
Salesforce Developer Blog developer.salesforce.com
Trailhead trailhead.salesforce.com
Quit Jesting and Test your Lightning Web Components, Phillipe Ozil

More Related Content

What's hot

Build Engaging Community Experiences with Community Cloud
Build Engaging Community Experiences with Community CloudBuild Engaging Community Experiences with Community Cloud
Build Engaging Community Experiences with Community CloudSalesforce Developers
 
Gesture Controlled Interactions with Platform Events and IoT Explorer
Gesture Controlled Interactions with Platform Events and IoT ExplorerGesture Controlled Interactions with Platform Events and IoT Explorer
Gesture Controlled Interactions with Platform Events and IoT ExplorerSalesforce Developers
 
A Developer's Guide to Visual Workflow
A Developer's Guide to Visual WorkflowA Developer's Guide to Visual Workflow
A Developer's Guide to Visual WorkflowSalesforce Developers
 
SalesforceDX Demo by Manish
SalesforceDX Demo by ManishSalesforceDX Demo by Manish
SalesforceDX Demo by ManishManish Thaduri
 
Sandboxes: The Future of App Development by Evan Barnet & Pam Barnet
Sandboxes: The Future of App Development by Evan Barnet & Pam BarnetSandboxes: The Future of App Development by Evan Barnet & Pam Barnet
Sandboxes: The Future of App Development by Evan Barnet & Pam BarnetSalesforce Admins
 
#Df17 Recap Series Build Apps Faster with the Salesforce Platform
#Df17 Recap Series Build Apps Faster with the Salesforce Platform #Df17 Recap Series Build Apps Faster with the Salesforce Platform
#Df17 Recap Series Build Apps Faster with the Salesforce Platform Salesforce Developers
 
Scale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in SalesforceScale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in SalesforceSalesforce Developers
 
#DF17Recap series: Integrate apps easier with the Salesforce platform
#DF17Recap series: Integrate apps easier with the Salesforce platform#DF17Recap series: Integrate apps easier with the Salesforce platform
#DF17Recap series: Integrate apps easier with the Salesforce platformSalesforce Developers
 
Manage Massive Datasets with Big Objects & Async SOQL
Manage Massive Datasets with  Big Objects & Async SOQLManage Massive Datasets with  Big Objects & Async SOQL
Manage Massive Datasets with Big Objects & Async SOQLSalesforce Developers
 
AppExchange Tech Enablement June 2017
AppExchange Tech Enablement June 2017AppExchange Tech Enablement June 2017
AppExchange Tech Enablement June 2017Salesforce Partners
 
Community Cloud: New in Summer ‘18
Community Cloud: New in Summer ‘18Community Cloud: New in Summer ‘18
Community Cloud: New in Summer ‘18Salesforce Developers
 
Lightning Developer Experience, Eclipse IDE Evolved
Lightning Developer Experience, Eclipse IDE EvolvedLightning Developer Experience, Eclipse IDE Evolved
Lightning Developer Experience, Eclipse IDE EvolvedSalesforce Developers
 
Process Automation on Lightning Platform Workshop
Process Automation on Lightning Platform WorkshopProcess Automation on Lightning Platform Workshop
Process Automation on Lightning Platform WorkshopSalesforce Developers
 
A Pocket Guide to Process Builder, Flows, and Triggers
A Pocket Guide to Process Builder, Flows, and TriggersA Pocket Guide to Process Builder, Flows, and Triggers
A Pocket Guide to Process Builder, Flows, and TriggersSalesforce Developers
 
Easy No-Code Integrations with External Services and Visual Flow
Easy No-Code Integrations with External Services and Visual FlowEasy No-Code Integrations with External Services and Visual Flow
Easy No-Code Integrations with External Services and Visual FlowSalesforce Developers
 
ここまでできる!Salesforce Connect 最新機能 (Winter'17) のご紹介
ここまでできる!Salesforce Connect 最新機能 (Winter'17) のご紹介ここまでできる!Salesforce Connect 最新機能 (Winter'17) のご紹介
ここまでできる!Salesforce Connect 最新機能 (Winter'17) のご紹介Salesforce Developers Japan
 
Maximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component PerformanceMaximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component PerformanceSalesforce Developers
 
Partner Roadmap Webinar (August 3, 2017)
Partner Roadmap Webinar (August 3, 2017)Partner Roadmap Webinar (August 3, 2017)
Partner Roadmap Webinar (August 3, 2017)Salesforce Partners
 

What's hot (20)

Build Engaging Community Experiences with Community Cloud
Build Engaging Community Experiences with Community CloudBuild Engaging Community Experiences with Community Cloud
Build Engaging Community Experiences with Community Cloud
 
Gesture Controlled Interactions with Platform Events and IoT Explorer
Gesture Controlled Interactions with Platform Events and IoT ExplorerGesture Controlled Interactions with Platform Events and IoT Explorer
Gesture Controlled Interactions with Platform Events and IoT Explorer
 
A Developer's Guide to Visual Workflow
A Developer's Guide to Visual WorkflowA Developer's Guide to Visual Workflow
A Developer's Guide to Visual Workflow
 
SalesforceDX Demo by Manish
SalesforceDX Demo by ManishSalesforceDX Demo by Manish
SalesforceDX Demo by Manish
 
Summer '18 Developer Highlights
Summer '18 Developer HighlightsSummer '18 Developer Highlights
Summer '18 Developer Highlights
 
Sandboxes: The Future of App Development by Evan Barnet & Pam Barnet
Sandboxes: The Future of App Development by Evan Barnet & Pam BarnetSandboxes: The Future of App Development by Evan Barnet & Pam Barnet
Sandboxes: The Future of App Development by Evan Barnet & Pam Barnet
 
#Df17 Recap Series Build Apps Faster with the Salesforce Platform
#Df17 Recap Series Build Apps Faster with the Salesforce Platform #Df17 Recap Series Build Apps Faster with the Salesforce Platform
#Df17 Recap Series Build Apps Faster with the Salesforce Platform
 
Scale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in SalesforceScale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in Salesforce
 
#DF17Recap series: Integrate apps easier with the Salesforce platform
#DF17Recap series: Integrate apps easier with the Salesforce platform#DF17Recap series: Integrate apps easier with the Salesforce platform
#DF17Recap series: Integrate apps easier with the Salesforce platform
 
Manage Massive Datasets with Big Objects & Async SOQL
Manage Massive Datasets with  Big Objects & Async SOQLManage Massive Datasets with  Big Objects & Async SOQL
Manage Massive Datasets with Big Objects & Async SOQL
 
AppExchange Tech Enablement June 2017
AppExchange Tech Enablement June 2017AppExchange Tech Enablement June 2017
AppExchange Tech Enablement June 2017
 
Community Cloud: New in Summer ‘18
Community Cloud: New in Summer ‘18Community Cloud: New in Summer ‘18
Community Cloud: New in Summer ‘18
 
Introduction to MuleSoft
Introduction to MuleSoftIntroduction to MuleSoft
Introduction to MuleSoft
 
Lightning Developer Experience, Eclipse IDE Evolved
Lightning Developer Experience, Eclipse IDE EvolvedLightning Developer Experience, Eclipse IDE Evolved
Lightning Developer Experience, Eclipse IDE Evolved
 
Process Automation on Lightning Platform Workshop
Process Automation on Lightning Platform WorkshopProcess Automation on Lightning Platform Workshop
Process Automation on Lightning Platform Workshop
 
A Pocket Guide to Process Builder, Flows, and Triggers
A Pocket Guide to Process Builder, Flows, and TriggersA Pocket Guide to Process Builder, Flows, and Triggers
A Pocket Guide to Process Builder, Flows, and Triggers
 
Easy No-Code Integrations with External Services and Visual Flow
Easy No-Code Integrations with External Services and Visual FlowEasy No-Code Integrations with External Services and Visual Flow
Easy No-Code Integrations with External Services and Visual Flow
 
ここまでできる!Salesforce Connect 最新機能 (Winter'17) のご紹介
ここまでできる!Salesforce Connect 最新機能 (Winter'17) のご紹介ここまでできる!Salesforce Connect 最新機能 (Winter'17) のご紹介
ここまでできる!Salesforce Connect 最新機能 (Winter'17) のご紹介
 
Maximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component PerformanceMaximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component Performance
 
Partner Roadmap Webinar (August 3, 2017)
Partner Roadmap Webinar (August 3, 2017)Partner Roadmap Webinar (August 3, 2017)
Partner Roadmap Webinar (August 3, 2017)
 

Similar to Quit Jesting and Test your Lightning Web Components, Phillipe Ozil

Java Tech & Tools | Deploying Java & Play Framework Apps to the Cloud | Sande...
Java Tech & Tools | Deploying Java & Play Framework Apps to the Cloud | Sande...Java Tech & Tools | Deploying Java & Play Framework Apps to the Cloud | Sande...
Java Tech & Tools | Deploying Java & Play Framework Apps to the Cloud | Sande...JAX London
 
Scaling to Millions of Devices and Billions of Events
Scaling to Millions of Devices and Billions of EventsScaling to Millions of Devices and Billions of Events
Scaling to Millions of Devices and Billions of EventsSalesforce Developers
 
Modern App Dev: Modular Development Strategies
Modern App Dev: Modular Development StrategiesModern App Dev: Modular Development Strategies
Modern App Dev: Modular Development StrategiesSalesforce Developers
 
Spring '14 Release Developer Preview Webinar
Spring '14 Release Developer Preview WebinarSpring '14 Release Developer Preview Webinar
Spring '14 Release Developer Preview WebinarSalesforce Developers
 
Utilizing SVN Jenkins to Manage Multi-line Development to Deployments
Utilizing SVN  Jenkins to Manage Multi-line Development to DeploymentsUtilizing SVN  Jenkins to Manage Multi-line Development to Deployments
Utilizing SVN Jenkins to Manage Multi-line Development to DeploymentsTeresa Garcia-Bovenmyer ☁
 
Salesforce1 Platform for programmers
Salesforce1 Platform for programmersSalesforce1 Platform for programmers
Salesforce1 Platform for programmersSalesforce Developers
 
Building Command-line Tools with the Tooling API
Building Command-line Tools with the Tooling APIBuilding Command-line Tools with the Tooling API
Building Command-line Tools with the Tooling APIJeff Douglas
 
JavaScript Unit Testing
JavaScript Unit TestingJavaScript Unit Testing
JavaScript Unit TestingKeir Bowden
 
Reusable Build Scripts for Managed Package Development (October 14, 2014)
Reusable Build Scripts for Managed Package Development (October 14, 2014)Reusable Build Scripts for Managed Package Development (October 14, 2014)
Reusable Build Scripts for Managed Package Development (October 14, 2014)Salesforce Partners
 
ApexUnit: Open source test framework for apex
ApexUnit: Open source test framework for apexApexUnit: Open source test framework for apex
ApexUnit: Open source test framework for apexVamshidhar Gandham
 
Visualforce Hack for Junction Objects
Visualforce Hack for Junction ObjectsVisualforce Hack for Junction Objects
Visualforce Hack for Junction ObjectsRitesh Aswaney
 
Environment & Release Management
Environment & Release ManagementEnvironment & Release Management
Environment & Release Managementelliando dias
 
Lightning web components - Episode 4 : Security and Testing
Lightning web components  - Episode 4 : Security and TestingLightning web components  - Episode 4 : Security and Testing
Lightning web components - Episode 4 : Security and TestingSalesforce Developers
 
An Admin's Guide to the Developer Console by Francis Pindar
An Admin's Guide to the Developer Console by Francis PindarAn Admin's Guide to the Developer Console by Francis Pindar
An Admin's Guide to the Developer Console by Francis PindarSalesforce Admins
 
Continuous Integration In The Cloud Final (1)
Continuous Integration In The Cloud Final (1)Continuous Integration In The Cloud Final (1)
Continuous Integration In The Cloud Final (1)Alexis Williams
 
Bug Hunting with the Salesforce Developer Console
Bug Hunting with the Salesforce Developer ConsoleBug Hunting with the Salesforce Developer Console
Bug Hunting with the Salesforce Developer ConsoleMatthew Poe
 
DevOps in Salesforce AppCloud
DevOps in Salesforce AppCloudDevOps in Salesforce AppCloud
DevOps in Salesforce AppCloudrsg00usa
 

Similar to Quit Jesting and Test your Lightning Web Components, Phillipe Ozil (20)

Java Tech & Tools | Deploying Java & Play Framework Apps to the Cloud | Sande...
Java Tech & Tools | Deploying Java & Play Framework Apps to the Cloud | Sande...Java Tech & Tools | Deploying Java & Play Framework Apps to the Cloud | Sande...
Java Tech & Tools | Deploying Java & Play Framework Apps to the Cloud | Sande...
 
Scaling to Millions of Devices and Billions of Events
Scaling to Millions of Devices and Billions of EventsScaling to Millions of Devices and Billions of Events
Scaling to Millions of Devices and Billions of Events
 
Force.com Friday : Intro to Apex
Force.com Friday : Intro to Apex Force.com Friday : Intro to Apex
Force.com Friday : Intro to Apex
 
Intro to Apex Programmers
Intro to Apex ProgrammersIntro to Apex Programmers
Intro to Apex Programmers
 
Coding in the App Cloud
Coding in the App CloudCoding in the App Cloud
Coding in the App Cloud
 
Modern App Dev: Modular Development Strategies
Modern App Dev: Modular Development StrategiesModern App Dev: Modular Development Strategies
Modern App Dev: Modular Development Strategies
 
Spring '14 Release Developer Preview Webinar
Spring '14 Release Developer Preview WebinarSpring '14 Release Developer Preview Webinar
Spring '14 Release Developer Preview Webinar
 
Utilizing SVN Jenkins to Manage Multi-line Development to Deployments
Utilizing SVN  Jenkins to Manage Multi-line Development to DeploymentsUtilizing SVN  Jenkins to Manage Multi-line Development to Deployments
Utilizing SVN Jenkins to Manage Multi-line Development to Deployments
 
Salesforce1 Platform for programmers
Salesforce1 Platform for programmersSalesforce1 Platform for programmers
Salesforce1 Platform for programmers
 
Building Command-line Tools with the Tooling API
Building Command-line Tools with the Tooling APIBuilding Command-line Tools with the Tooling API
Building Command-line Tools with the Tooling API
 
JavaScript Unit Testing
JavaScript Unit TestingJavaScript Unit Testing
JavaScript Unit Testing
 
Reusable Build Scripts for Managed Package Development (October 14, 2014)
Reusable Build Scripts for Managed Package Development (October 14, 2014)Reusable Build Scripts for Managed Package Development (October 14, 2014)
Reusable Build Scripts for Managed Package Development (October 14, 2014)
 
ApexUnit: Open source test framework for apex
ApexUnit: Open source test framework for apexApexUnit: Open source test framework for apex
ApexUnit: Open source test framework for apex
 
Visualforce Hack for Junction Objects
Visualforce Hack for Junction ObjectsVisualforce Hack for Junction Objects
Visualforce Hack for Junction Objects
 
Environment & Release Management
Environment & Release ManagementEnvironment & Release Management
Environment & Release Management
 
Lightning web components - Episode 4 : Security and Testing
Lightning web components  - Episode 4 : Security and TestingLightning web components  - Episode 4 : Security and Testing
Lightning web components - Episode 4 : Security and Testing
 
An Admin's Guide to the Developer Console by Francis Pindar
An Admin's Guide to the Developer Console by Francis PindarAn Admin's Guide to the Developer Console by Francis Pindar
An Admin's Guide to the Developer Console by Francis Pindar
 
Continuous Integration In The Cloud Final (1)
Continuous Integration In The Cloud Final (1)Continuous Integration In The Cloud Final (1)
Continuous Integration In The Cloud Final (1)
 
Bug Hunting with the Salesforce Developer Console
Bug Hunting with the Salesforce Developer ConsoleBug Hunting with the Salesforce Developer Console
Bug Hunting with the Salesforce Developer Console
 
DevOps in Salesforce AppCloud
DevOps in Salesforce AppCloudDevOps in Salesforce AppCloud
DevOps in Salesforce AppCloud
 

More from CzechDreamin

Salesforce Forecasting: Evolution, Implementation and Best Practices, Christi...
Salesforce Forecasting: Evolution, Implementation and Best Practices, Christi...Salesforce Forecasting: Evolution, Implementation and Best Practices, Christi...
Salesforce Forecasting: Evolution, Implementation and Best Practices, Christi...CzechDreamin
 
Supercharge Salesforce Marketing Cloud: The Ultimate Apps Guide, Cyril Louis ...
Supercharge Salesforce Marketing Cloud: The Ultimate Apps Guide, Cyril Louis ...Supercharge Salesforce Marketing Cloud: The Ultimate Apps Guide, Cyril Louis ...
Supercharge Salesforce Marketing Cloud: The Ultimate Apps Guide, Cyril Louis ...CzechDreamin
 
How we should include Devops Center to get happy developers?, David Fernandez...
How we should include Devops Center to get happy developers?, David Fernandez...How we should include Devops Center to get happy developers?, David Fernandez...
How we should include Devops Center to get happy developers?, David Fernandez...CzechDreamin
 
Streamline Your Integration with Salesforce’s Composite API: A Consultant’s G...
Streamline Your Integration with Salesforce’s Composite API: A Consultant’s G...Streamline Your Integration with Salesforce’s Composite API: A Consultant’s G...
Streamline Your Integration with Salesforce’s Composite API: A Consultant’s G...CzechDreamin
 
Architecting for Analytics, Aaron Crear
Architecting for Analytics, Aaron CrearArchitecting for Analytics, Aaron Crear
Architecting for Analytics, Aaron CrearCzechDreamin
 
Ape to API, Filip Dousek
Ape to API, Filip DousekApe to API, Filip Dousek
Ape to API, Filip DousekCzechDreamin
 
Push Upgrades, The last mile of Salesforce DevOps, Manuel Moya
Push Upgrades, The last mile of Salesforce DevOps, Manuel MoyaPush Upgrades, The last mile of Salesforce DevOps, Manuel Moya
Push Upgrades, The last mile of Salesforce DevOps, Manuel MoyaCzechDreamin
 
How do you know you’re solving the right problem? Design Thinking for Salesfo...
How do you know you’re solving the right problem? Design Thinking for Salesfo...How do you know you’re solving the right problem? Design Thinking for Salesfo...
How do you know you’re solving the right problem? Design Thinking for Salesfo...CzechDreamin
 
ChatGPT … How Does it Flow?, Mark Jones
ChatGPT … How Does it Flow?, Mark JonesChatGPT … How Does it Flow?, Mark Jones
ChatGPT … How Does it Flow?, Mark JonesCzechDreamin
 
Real-time communication with Account Engagement (Pardot). Marketers meet deve...
Real-time communication with Account Engagement (Pardot). Marketers meet deve...Real-time communication with Account Engagement (Pardot). Marketers meet deve...
Real-time communication with Account Engagement (Pardot). Marketers meet deve...CzechDreamin
 
Black Hat Session: Exploring and Exploiting Aura based Experiences, Christian...
Black Hat Session: Exploring and Exploiting Aura based Experiences, Christian...Black Hat Session: Exploring and Exploiting Aura based Experiences, Christian...
Black Hat Session: Exploring and Exploiting Aura based Experiences, Christian...CzechDreamin
 
Sales methodology for Salesforce Opportunity, Georgy Avilov
Sales methodology for Salesforce Opportunity, Georgy AvilovSales methodology for Salesforce Opportunity, Georgy Avilov
Sales methodology for Salesforce Opportunity, Georgy AvilovCzechDreamin
 
5 key ideas for robust and flexible REST API integrations with Apex, Lucian M...
5 key ideas for robust and flexible REST API integrations with Apex, Lucian M...5 key ideas for robust and flexible REST API integrations with Apex, Lucian M...
5 key ideas for robust and flexible REST API integrations with Apex, Lucian M...CzechDreamin
 
Report & Dashboard REST API : Get your report accessible anywhere !, Romain Q...
Report & Dashboard REST API : Get your report accessible anywhere !, Romain Q...Report & Dashboard REST API : Get your report accessible anywhere !, Romain Q...
Report & Dashboard REST API : Get your report accessible anywhere !, Romain Q...CzechDreamin
 
No Such Thing as Best Practice in Design, Nati Asher and Pat Fragoso
No Such Thing as Best Practice in Design, Nati Asher and Pat FragosoNo Such Thing as Best Practice in Design, Nati Asher and Pat Fragoso
No Such Thing as Best Practice in Design, Nati Asher and Pat FragosoCzechDreamin
 
Why do you Need to Migrate to Salesforce Flow?, Andrew Cook
Why do you Need to Migrate to Salesforce Flow?, Andrew CookWhy do you Need to Migrate to Salesforce Flow?, Andrew Cook
Why do you Need to Migrate to Salesforce Flow?, Andrew CookCzechDreamin
 
Be kind to your future admin self, Silvia Denaro & Nathaniel Sombu
Be kind to your future admin self, Silvia Denaro & Nathaniel SombuBe kind to your future admin self, Silvia Denaro & Nathaniel Sombu
Be kind to your future admin self, Silvia Denaro & Nathaniel SombuCzechDreamin
 
Monitoring Automation Performance in Marketing Cloud Engagement, Daniela Vrbk...
Monitoring Automation Performance in Marketing Cloud Engagement, Daniela Vrbk...Monitoring Automation Performance in Marketing Cloud Engagement, Daniela Vrbk...
Monitoring Automation Performance in Marketing Cloud Engagement, Daniela Vrbk...CzechDreamin
 
The minimum-profile approach – the modern way to design an efficient security...
The minimum-profile approach – the modern way to design an efficient security...The minimum-profile approach – the modern way to design an efficient security...
The minimum-profile approach – the modern way to design an efficient security...CzechDreamin
 
Restriction Rules – The Whole Picture, Louise Lockie
Restriction Rules – The Whole Picture, Louise LockieRestriction Rules – The Whole Picture, Louise Lockie
Restriction Rules – The Whole Picture, Louise LockieCzechDreamin
 

More from CzechDreamin (20)

Salesforce Forecasting: Evolution, Implementation and Best Practices, Christi...
Salesforce Forecasting: Evolution, Implementation and Best Practices, Christi...Salesforce Forecasting: Evolution, Implementation and Best Practices, Christi...
Salesforce Forecasting: Evolution, Implementation and Best Practices, Christi...
 
Supercharge Salesforce Marketing Cloud: The Ultimate Apps Guide, Cyril Louis ...
Supercharge Salesforce Marketing Cloud: The Ultimate Apps Guide, Cyril Louis ...Supercharge Salesforce Marketing Cloud: The Ultimate Apps Guide, Cyril Louis ...
Supercharge Salesforce Marketing Cloud: The Ultimate Apps Guide, Cyril Louis ...
 
How we should include Devops Center to get happy developers?, David Fernandez...
How we should include Devops Center to get happy developers?, David Fernandez...How we should include Devops Center to get happy developers?, David Fernandez...
How we should include Devops Center to get happy developers?, David Fernandez...
 
Streamline Your Integration with Salesforce’s Composite API: A Consultant’s G...
Streamline Your Integration with Salesforce’s Composite API: A Consultant’s G...Streamline Your Integration with Salesforce’s Composite API: A Consultant’s G...
Streamline Your Integration with Salesforce’s Composite API: A Consultant’s G...
 
Architecting for Analytics, Aaron Crear
Architecting for Analytics, Aaron CrearArchitecting for Analytics, Aaron Crear
Architecting for Analytics, Aaron Crear
 
Ape to API, Filip Dousek
Ape to API, Filip DousekApe to API, Filip Dousek
Ape to API, Filip Dousek
 
Push Upgrades, The last mile of Salesforce DevOps, Manuel Moya
Push Upgrades, The last mile of Salesforce DevOps, Manuel MoyaPush Upgrades, The last mile of Salesforce DevOps, Manuel Moya
Push Upgrades, The last mile of Salesforce DevOps, Manuel Moya
 
How do you know you’re solving the right problem? Design Thinking for Salesfo...
How do you know you’re solving the right problem? Design Thinking for Salesfo...How do you know you’re solving the right problem? Design Thinking for Salesfo...
How do you know you’re solving the right problem? Design Thinking for Salesfo...
 
ChatGPT … How Does it Flow?, Mark Jones
ChatGPT … How Does it Flow?, Mark JonesChatGPT … How Does it Flow?, Mark Jones
ChatGPT … How Does it Flow?, Mark Jones
 
Real-time communication with Account Engagement (Pardot). Marketers meet deve...
Real-time communication with Account Engagement (Pardot). Marketers meet deve...Real-time communication with Account Engagement (Pardot). Marketers meet deve...
Real-time communication with Account Engagement (Pardot). Marketers meet deve...
 
Black Hat Session: Exploring and Exploiting Aura based Experiences, Christian...
Black Hat Session: Exploring and Exploiting Aura based Experiences, Christian...Black Hat Session: Exploring and Exploiting Aura based Experiences, Christian...
Black Hat Session: Exploring and Exploiting Aura based Experiences, Christian...
 
Sales methodology for Salesforce Opportunity, Georgy Avilov
Sales methodology for Salesforce Opportunity, Georgy AvilovSales methodology for Salesforce Opportunity, Georgy Avilov
Sales methodology for Salesforce Opportunity, Georgy Avilov
 
5 key ideas for robust and flexible REST API integrations with Apex, Lucian M...
5 key ideas for robust and flexible REST API integrations with Apex, Lucian M...5 key ideas for robust and flexible REST API integrations with Apex, Lucian M...
5 key ideas for robust and flexible REST API integrations with Apex, Lucian M...
 
Report & Dashboard REST API : Get your report accessible anywhere !, Romain Q...
Report & Dashboard REST API : Get your report accessible anywhere !, Romain Q...Report & Dashboard REST API : Get your report accessible anywhere !, Romain Q...
Report & Dashboard REST API : Get your report accessible anywhere !, Romain Q...
 
No Such Thing as Best Practice in Design, Nati Asher and Pat Fragoso
No Such Thing as Best Practice in Design, Nati Asher and Pat FragosoNo Such Thing as Best Practice in Design, Nati Asher and Pat Fragoso
No Such Thing as Best Practice in Design, Nati Asher and Pat Fragoso
 
Why do you Need to Migrate to Salesforce Flow?, Andrew Cook
Why do you Need to Migrate to Salesforce Flow?, Andrew CookWhy do you Need to Migrate to Salesforce Flow?, Andrew Cook
Why do you Need to Migrate to Salesforce Flow?, Andrew Cook
 
Be kind to your future admin self, Silvia Denaro & Nathaniel Sombu
Be kind to your future admin self, Silvia Denaro & Nathaniel SombuBe kind to your future admin self, Silvia Denaro & Nathaniel Sombu
Be kind to your future admin self, Silvia Denaro & Nathaniel Sombu
 
Monitoring Automation Performance in Marketing Cloud Engagement, Daniela Vrbk...
Monitoring Automation Performance in Marketing Cloud Engagement, Daniela Vrbk...Monitoring Automation Performance in Marketing Cloud Engagement, Daniela Vrbk...
Monitoring Automation Performance in Marketing Cloud Engagement, Daniela Vrbk...
 
The minimum-profile approach – the modern way to design an efficient security...
The minimum-profile approach – the modern way to design an efficient security...The minimum-profile approach – the modern way to design an efficient security...
The minimum-profile approach – the modern way to design an efficient security...
 
Restriction Rules – The Whole Picture, Louise Lockie
Restriction Rules – The Whole Picture, Louise LockieRestriction Rules – The Whole Picture, Louise Lockie
Restriction Rules – The Whole Picture, Louise Lockie
 

Recently uploaded

unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 

Recently uploaded (20)

unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 

Quit Jesting and Test your Lightning Web Components, Phillipe Ozil

  • 1.
  • 2. Forward-Looking Statement This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements. Statement under the Private Securities Litigation Reform Act of 1995
  • 5. A Distinct Environment for Unit Testing Runtime environment = Salesforce Platform Production org, sandbox, scratch org... Jest + jest-lwc extension ESLint + LWC rules + + + Custom dependencies ? Unit Testing environment = Local machine Optional
  • 6. Running Local Tests Standard JS testing Flexible configuration and popular JS tools No Platform access => testing in isolation Tests must be saved in revision control No code coverage requirement
  • 7. Jest One of the most popular JS testing frameworks (speed, features, doc…) Works with vanilla JS and HTML (JSDOM) Open Source from Facebook Extensions for specific JS frameworks
  • 8. Jest for Lightning Web Components: lwc-jest Jest extension that brings LWC-specific testing features ● Base Lightning Component mocks ● @Wire mocking utility
  • 9. ESLint and Lightning Web Components rules Not required for testing but highly recommended Linting utility for JS Covers component code + test code
  • 10. Test Environment Minimal Setup Requirements: Node.js + Salesforce DX project 1) Run these commands: 2) Add test scripts to the Node project configuration: npm init npm install npm install @salesforce/lwc-jest --save-dev "scripts": { "test:unit": "lwc-jest", "test:unit:watch": "lwc-jest --watch", "test:unit:coverage": "lwc-jest --coverage" },
  • 12. Adding Tests for a Component lwc hello __tests__ hello.tests.js hello.html hello.js hello.js-meta.xml
  • 13. describe('c-hello', () => { afterEach(() => { // TODO: cleanup after tests }); it('displays greeting', () => { // TODO: run test }); }); Test File Structure Test suite Teardown instructions (optional) Test
  • 14. A Refresher on the Testing Mindset Given Prepare test When Test behavior Then Assert expected result
  • 15. Given – Prepare Test Most of the time: add component to the DOM + set public properties const element = createElement('recipe-contact-tile', { is: ContactTile }); element.contact = CONTACT_INPUT; document.body.appendChild(element);
  • 16. When – Test Behavior Execute the test (click a button, enter some text, call a wire…) element.shadowRoot.querySelector('lightning-button’).click(); const inputEl = element.shadowRoot.querySelector('lightning-input'); inputEl.value = USER_INPUT; inputEl.dispatchEvent(new CustomEvent('change')); getContactListAdapter.emit(mockGetContactList);
  • 17. Then – Assert Expected Result Assertions written with a fluent syntax expect(div.textContent).toBe(`Hello, ${EXPECTED}!`); expect(errorPanelElement).not.toBeNull(); expect(mockSelectHandler).toHaveBeenCalledTimes(1); Matchers
  • 19. Two Types of Tests DOM inspection tests • Covers <template> • rendering logic • events • Needed but... • no test coverage • harder to maintain Logic tests • Covers JS logic, wire calls • Test coverage
  • 20. Naming Tests Suite name describes unit under test Test name describes scenario and expectation // Unit under test describe('c-apex-wire-method-to-property', () => { describe('getContactList @wire data', () => { // Expectation and scenario it('renders no items when no records are available', () => { }); }); });
  • 21. Test Data Use realistic input data Use module level constants Move test data sets to .json files
  • 22. Focus on Back-Box Testing Test public methods, templates and events first No need to reach 100% code coverage
  • 24. What we’ve covered Local testing environment with Jest How to write behavior-driven tests Focusing on black-box testing
  • 25. Next Steps Add Prettier Setup CI Monitor code coverage evolution
  • 26. Resources Jest website jestjs.io Sample App Gallery (Recipes in particular) trailhead.salesforce.com/sample-gallery Salesforce Developer Blog developer.salesforce.com Trailhead trailhead.salesforce.com

Editor's Notes

  1. Key Message Salesforce is a publicly traded company. Customers should make buying decisions only on the products commercially available. Talk Track Before I begin, just a quick note that you should base your purchasing decisions on products and services that are currently available.