SlideShare une entreprise Scribd logo
1  sur  23
Salesforce World Tour
London May 21, 2015
Keir Bowden
CTO, BrightGen
@bob_buzzard
Speaker
Safe Harbor
Safe harbor statement under the Private Securities Litigation Reform Act of 1995:
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 intellectual property and other
litigation, risks associated with 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-Q for the
most recent fiscal quarter ended July 31, 2012. This 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.
Agenda
• Introduction
• Tools
• Visualforce
• Lightning Components
• Q & A
Introduction
Introduction
• Why write unit tests?
– Give confidence
– Reduce cost of bugs
– Produce testable code
– Promote refactoring
JavaScript on Salesforce Challenges
• No test context for client
– Changes aren’t rolled back
• Side effects:
– DOM manipulation
– Server calls
Techniques
• Write testable code
– Unobtrusive JavaScript
– Avoid anonymous functions
– Functional decomposition
• Functions to decide on action
• Functions to take the action
function redirectToURL(url) {
if (“#”===url.charAt(0)) {
window.location.hash=url;
} else if (“/”===url.charAt(0))
window.location.pathname=url;
}
....
Demo App
Github:
bobbuzz.me.uk/JSUTSF
Public Site:
Jobs:
bobbuzz.me.uk/1Ad25OG
Tests:
bobbuzz.me.uk/1PvhII3
Tools
QUnit
• Pure JavaScript Unit Test Framework
• Executes in-browser
• From the developers of jQuery
<apex:includeScript
value="{!$Resource.qunitJS}"/>
<apex:stylesheet
value="{!$Resource.qunitCSS}"/>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
Test markup container
QUnit
• Module – group of tests
• Test – single test
• Assert – confirm behaviour
QUnit.module("JOBLIST", {
beforeEach: function(assert) {
// setup code
},
afterEach : function(assert) {
// teardown code
}
});
QUnit.test("Show Progress", function( assert ) {
jobCtrl.showProgress();
});
assert.equal(jobCtrl.progressCount, 1,
"Progress count is one");
Sinon.JS
• Pure JavaScript
• Works with any test framework
• Three elements:
– Spies – records execution, parameters
– Stubs – Spies + replace functions
– Mocks – Stubs + expected behaviour
Sinon Stub
this.searchStub = sinon.stub(jobCtrl,
"doSearch");
var jobCtrl={
doSearch : function(ev) {
// remote call to server
}
};
jobCtrl.doSearch(event);
doSearch : function() {
// sinon stub code
}
assert.equal(this.searchStub.callCount,1,
"search called once");
this.searchStub.restore();
doSearch : function(ev) {
// remote call to server
}
$('#searchbtn').on("click",
jobCtrl.doSearch);
Blanket.js
• Code coverage!
• Pure JavaScript
• Works with QUnit, Mocha and Jasmine
• JavaScript must be external
<apex:includeScript value="{!$Resource.blanketJS}"/>
<script src="{!$Resource.JobsJS}" data-cover="true"></script>
Blanket.js
Visualforce
Visualforce
• Dedicated test page
• Replicate markup as required
• Include JavaScript to be tested
• Can capture coverage
• Demo
Lightning Components
Challenges
• Components are isolated
• JavaScript in controller + helper
• Cannot capture coverage
• Markup is fixed
• How to trigger tests?
My Solution
• QUnit tests in helper function
• Controller method to execute helper function
• Lightning test application (equivalent to page)
• Tests executed via event
– Fired by application
– Handled by component under test
• Demo
Keir Bowden
CTO, BrightGen
@bob_buzzard
Q & A
Thank you

Contenu connexe

Tendances

An easy way to automate complex UI
An easy way to automate complex UIAn easy way to automate complex UI
An easy way to automate complex UIIvan Pashko
 
Bdd with Cucumber and Mocha
Bdd with Cucumber and MochaBdd with Cucumber and Mocha
Bdd with Cucumber and MochaAtish Narlawar
 
Behavior Driven Testing - A paradigm shift
Behavior Driven Testing - A paradigm shiftBehavior Driven Testing - A paradigm shift
Behavior Driven Testing - A paradigm shiftAspire Systems
 
Team Development on Force.com with Github and Ant
Team Development on Force.com with Github and AntTeam Development on Force.com with Github and Ant
Team Development on Force.com with Github and AntSalesforce Developers
 
Continuous Integration - Software development lifecycle for Force.com projects
Continuous Integration - Software development lifecycle for Force.com projectsContinuous Integration - Software development lifecycle for Force.com projects
Continuous Integration - Software development lifecycle for Force.com projectsAldo Fernandez
 
Test Automation Pyramid
Test Automation PyramidTest Automation Pyramid
Test Automation PyramidvodQA
 
Client-Side Performance Testing
Client-Side Performance TestingClient-Side Performance Testing
Client-Side Performance TestingAnand Bagmar
 
Automating the Impossible: End to End Team Development for ISVs (October 14, ...
Automating the Impossible: End to End Team Development for ISVs (October 14, ...Automating the Impossible: End to End Team Development for ISVs (October 14, ...
Automating the Impossible: End to End Team Development for ISVs (October 14, ...Salesforce Partners
 
Web and load testing with Visual Studio 2010 Ultimate
Web and load testing with Visual Studio 2010 UltimateWeb and load testing with Visual Studio 2010 Ultimate
Web and load testing with Visual Studio 2010 UltimateAbhimanyu Singhal
 
Visual Studio 2010 Testing for Developers
Visual Studio 2010 Testing for DevelopersVisual Studio 2010 Testing for Developers
Visual Studio 2010 Testing for DevelopersSteve Lange
 
Visual AI Enhanced Testing on Dynamic Websites
Visual AI Enhanced Testing on Dynamic WebsitesVisual AI Enhanced Testing on Dynamic Websites
Visual AI Enhanced Testing on Dynamic WebsitesApplitools
 
Crossbrowser Testing at Salesforce Analytics
Crossbrowser Testing at Salesforce AnalyticsCrossbrowser Testing at Salesforce Analytics
Crossbrowser Testing at Salesforce AnalyticsSalesforce Engineering
 
Salesforce API Series: Release Management with the Metadata API webinar
Salesforce API Series: Release Management with the Metadata API webinarSalesforce API Series: Release Management with the Metadata API webinar
Salesforce API Series: Release Management with the Metadata API webinarSalesforce Developers
 
Behaviour Driven Development (BDD) - Closing the Loop on a Great Fiori UX
Behaviour Driven Development (BDD) - Closing the Loop on a Great Fiori UXBehaviour Driven Development (BDD) - Closing the Loop on a Great Fiori UX
Behaviour Driven Development (BDD) - Closing the Loop on a Great Fiori UXJohn Patterson
 
Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...
Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...
Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...Salesforce Developers
 
Continuous Integration and Testing with Branch Orgs
Continuous Integration and Testing with Branch OrgsContinuous Integration and Testing with Branch Orgs
Continuous Integration and Testing with Branch OrgsSalesforce Developers
 
Roman iovlev battle - JDI vs Selenide - Selenium Camp
Roman iovlev battle - JDI vs Selenide - Selenium CampRoman iovlev battle - JDI vs Selenide - Selenium Camp
Roman iovlev battle - JDI vs Selenide - Selenium CampРоман Иовлев
 

Tendances (20)

An easy way to automate complex UI
An easy way to automate complex UIAn easy way to automate complex UI
An easy way to automate complex UI
 
Bdd with Cucumber and Mocha
Bdd with Cucumber and MochaBdd with Cucumber and Mocha
Bdd with Cucumber and Mocha
 
Behavior Driven Testing - A paradigm shift
Behavior Driven Testing - A paradigm shiftBehavior Driven Testing - A paradigm shift
Behavior Driven Testing - A paradigm shift
 
Team Development on Force.com with Github and Ant
Team Development on Force.com with Github and AntTeam Development on Force.com with Github and Ant
Team Development on Force.com with Github and Ant
 
Continuous Integration - Software development lifecycle for Force.com projects
Continuous Integration - Software development lifecycle for Force.com projectsContinuous Integration - Software development lifecycle for Force.com projects
Continuous Integration - Software development lifecycle for Force.com projects
 
Test Automation Pyramid
Test Automation PyramidTest Automation Pyramid
Test Automation Pyramid
 
Gowtham_resume
Gowtham_resumeGowtham_resume
Gowtham_resume
 
Client-Side Performance Testing
Client-Side Performance TestingClient-Side Performance Testing
Client-Side Performance Testing
 
Automating the Impossible: End to End Team Development for ISVs (October 14, ...
Automating the Impossible: End to End Team Development for ISVs (October 14, ...Automating the Impossible: End to End Team Development for ISVs (October 14, ...
Automating the Impossible: End to End Team Development for ISVs (October 14, ...
 
Web and load testing with Visual Studio 2010 Ultimate
Web and load testing with Visual Studio 2010 UltimateWeb and load testing with Visual Studio 2010 Ultimate
Web and load testing with Visual Studio 2010 Ultimate
 
Visual Studio 2010 Testing for Developers
Visual Studio 2010 Testing for DevelopersVisual Studio 2010 Testing for Developers
Visual Studio 2010 Testing for Developers
 
Visual AI Enhanced Testing on Dynamic Websites
Visual AI Enhanced Testing on Dynamic WebsitesVisual AI Enhanced Testing on Dynamic Websites
Visual AI Enhanced Testing on Dynamic Websites
 
Crossbrowser Testing at Salesforce Analytics
Crossbrowser Testing at Salesforce AnalyticsCrossbrowser Testing at Salesforce Analytics
Crossbrowser Testing at Salesforce Analytics
 
Salesforce API Series: Release Management with the Metadata API webinar
Salesforce API Series: Release Management with the Metadata API webinarSalesforce API Series: Release Management with the Metadata API webinar
Salesforce API Series: Release Management with the Metadata API webinar
 
Behaviour Driven Development (BDD) - Closing the Loop on a Great Fiori UX
Behaviour Driven Development (BDD) - Closing the Loop on a Great Fiori UXBehaviour Driven Development (BDD) - Closing the Loop on a Great Fiori UX
Behaviour Driven Development (BDD) - Closing the Loop on a Great Fiori UX
 
Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...
Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...
Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...
 
Dev ops.enterprise.2014 (1)
Dev ops.enterprise.2014 (1)Dev ops.enterprise.2014 (1)
Dev ops.enterprise.2014 (1)
 
Under the Hood of Sandbox Templates
Under the Hood of Sandbox TemplatesUnder the Hood of Sandbox Templates
Under the Hood of Sandbox Templates
 
Continuous Integration and Testing with Branch Orgs
Continuous Integration and Testing with Branch OrgsContinuous Integration and Testing with Branch Orgs
Continuous Integration and Testing with Branch Orgs
 
Roman iovlev battle - JDI vs Selenide - Selenium Camp
Roman iovlev battle - JDI vs Selenide - Selenium CampRoman iovlev battle - JDI vs Selenide - Selenium Camp
Roman iovlev battle - JDI vs Selenide - Selenium Camp
 

En vedette

Unit Testing Lightning Components with Jasmine
Unit Testing Lightning Components with JasmineUnit Testing Lightning Components with Jasmine
Unit Testing Lightning Components with JasmineKeir Bowden
 
Testing javascript in the frontend
Testing javascript in the frontendTesting javascript in the frontend
Testing javascript in the frontendFrederic CABASSUT
 
The Developer Experience
The Developer ExperienceThe Developer Experience
The Developer ExperienceAtlassian
 
Developer Experience to Testing
Developer Experience to TestingDeveloper Experience to Testing
Developer Experience to TestingMozaic Works
 
Introducing Sencha Touch 2
Introducing Sencha Touch 2Introducing Sencha Touch 2
Introducing Sencha Touch 2Sencha
 
Painless JavaScript Testing with Jest
Painless JavaScript Testing with JestPainless JavaScript Testing with Jest
Painless JavaScript Testing with JestMichał Pierzchała
 
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016Gavin Pickin
 
Javascript testing: tools of the trade
Javascript testing: tools of the tradeJavascript testing: tools of the trade
Javascript testing: tools of the tradeJuanma Orta
 
Javascript Unit Testing Tools
Javascript Unit Testing ToolsJavascript Unit Testing Tools
Javascript Unit Testing ToolsPixelCrayons
 
JAVASCRIPT Test Driven Development & Jasmine
JAVASCRIPT Test Driven Development & JasmineJAVASCRIPT Test Driven Development & Jasmine
JAVASCRIPT Test Driven Development & JasmineAnup Singh
 
Unit-testing and E2E testing in JS
Unit-testing and E2E testing in JSUnit-testing and E2E testing in JS
Unit-testing and E2E testing in JSMichael Haberman
 
JavaScript Test-Driven Development with Jasmine 2.0 and Karma
JavaScript Test-Driven Development with Jasmine 2.0 and Karma JavaScript Test-Driven Development with Jasmine 2.0 and Karma
JavaScript Test-Driven Development with Jasmine 2.0 and Karma Christopher Bartling
 
SenchaCon 2016: The Changing Landscape of JavaScript Testing - Joel Watson an...
SenchaCon 2016: The Changing Landscape of JavaScript Testing - Joel Watson an...SenchaCon 2016: The Changing Landscape of JavaScript Testing - Joel Watson an...
SenchaCon 2016: The Changing Landscape of JavaScript Testing - Joel Watson an...Sencha
 
Михаил Боднарчук "Acceptance Testing in NodeJS: Tools & Approaches"
Михаил Боднарчук "Acceptance Testing in NodeJS: Tools & Approaches"Михаил Боднарчук "Acceptance Testing in NodeJS: Tools & Approaches"
Михаил Боднарчук "Acceptance Testing in NodeJS: Tools & Approaches"Fwdays
 

En vedette (15)

Unit Testing Lightning Components with Jasmine
Unit Testing Lightning Components with JasmineUnit Testing Lightning Components with Jasmine
Unit Testing Lightning Components with Jasmine
 
Testing javascript in the frontend
Testing javascript in the frontendTesting javascript in the frontend
Testing javascript in the frontend
 
The Developer Experience
The Developer ExperienceThe Developer Experience
The Developer Experience
 
Developer Experience to Testing
Developer Experience to TestingDeveloper Experience to Testing
Developer Experience to Testing
 
Introducing Sencha Touch 2
Introducing Sencha Touch 2Introducing Sencha Touch 2
Introducing Sencha Touch 2
 
Painless JavaScript Testing with Jest
Painless JavaScript Testing with JestPainless JavaScript Testing with Jest
Painless JavaScript Testing with Jest
 
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
 
Javascript testing: tools of the trade
Javascript testing: tools of the tradeJavascript testing: tools of the trade
Javascript testing: tools of the trade
 
Javascript Unit Testing Tools
Javascript Unit Testing ToolsJavascript Unit Testing Tools
Javascript Unit Testing Tools
 
JAVASCRIPT Test Driven Development & Jasmine
JAVASCRIPT Test Driven Development & JasmineJAVASCRIPT Test Driven Development & Jasmine
JAVASCRIPT Test Driven Development & Jasmine
 
Unit-testing and E2E testing in JS
Unit-testing and E2E testing in JSUnit-testing and E2E testing in JS
Unit-testing and E2E testing in JS
 
JavaScript Test-Driven Development with Jasmine 2.0 and Karma
JavaScript Test-Driven Development with Jasmine 2.0 and Karma JavaScript Test-Driven Development with Jasmine 2.0 and Karma
JavaScript Test-Driven Development with Jasmine 2.0 and Karma
 
SenchaCon 2016: The Changing Landscape of JavaScript Testing - Joel Watson an...
SenchaCon 2016: The Changing Landscape of JavaScript Testing - Joel Watson an...SenchaCon 2016: The Changing Landscape of JavaScript Testing - Joel Watson an...
SenchaCon 2016: The Changing Landscape of JavaScript Testing - Joel Watson an...
 
jasmine
jasminejasmine
jasmine
 
Михаил Боднарчук "Acceptance Testing in NodeJS: Tools & Approaches"
Михаил Боднарчук "Acceptance Testing in NodeJS: Tools & Approaches"Михаил Боднарчук "Acceptance Testing in NodeJS: Tools & Approaches"
Михаил Боднарчук "Acceptance Testing in NodeJS: Tools & Approaches"
 

Similaire à JavaScript Unit Testing

NgForce: A JS Library For Quickly Building Salesforce Apps Using AngularJS
NgForce: A JS Library For Quickly Building Salesforce Apps Using AngularJSNgForce: A JS Library For Quickly Building Salesforce Apps Using AngularJS
NgForce: A JS Library For Quickly Building Salesforce Apps Using AngularJSSalesforce Developers
 
Building Complex Traversing & Branching Apps Using Visual Workflows and Apex
Building Complex Traversing & Branching Apps Using Visual Workflows and ApexBuilding Complex Traversing & Branching Apps Using Visual Workflows and Apex
Building Complex Traversing & Branching Apps Using Visual Workflows and ApexSalesforce Developers
 
Intro to Apex - Salesforce Force Friday Webinar
Intro to Apex - Salesforce Force Friday Webinar Intro to Apex - Salesforce Force Friday Webinar
Intro to Apex - Salesforce Force Friday Webinar Abhinav Gupta
 
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
 
Force.com Friday: Intro to Visualforce (May 8, 2015)
Force.com Friday: Intro to Visualforce (May 8, 2015)Force.com Friday: Intro to Visualforce (May 8, 2015)
Force.com Friday: Intro to Visualforce (May 8, 2015)Salesforce Developers
 
Dreamforce 2014 - Salesforce Python SDK for REST/SOAP APIs
Dreamforce 2014 - Salesforce Python SDK for REST/SOAP APIsDreamforce 2014 - Salesforce Python SDK for REST/SOAP APIs
Dreamforce 2014 - Salesforce Python SDK for REST/SOAP APIsHormoz Tarevern
 
Spring '14 Release Developer Preview Webinar
Spring '14 Release Developer Preview WebinarSpring '14 Release Developer Preview Webinar
Spring '14 Release Developer Preview WebinarSalesforce Developers
 
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
 
Salesforce – Proven Platform Development with DevOps & Agile
Salesforce – Proven Platform Development with DevOps & AgileSalesforce – Proven Platform Development with DevOps & Agile
Salesforce – Proven Platform Development with DevOps & AgileSai Jithesh ☁️
 
All Aboard the Lightning Components Action Service
All Aboard the Lightning Components Action ServiceAll Aboard the Lightning Components Action Service
All Aboard the Lightning Components Action ServicePeter Chittum
 
Staying Ahead of the Curve with Lightning - Snowforce16 Keynote
Staying Ahead of the Curve with Lightning - Snowforce16 KeynoteStaying Ahead of the Curve with Lightning - Snowforce16 Keynote
Staying Ahead of the Curve with Lightning - Snowforce16 KeynoteSalesforce Admins
 
Release Management: Managing Your Internal Releases
Release Management: Managing Your Internal ReleasesRelease Management: Managing Your Internal Releases
Release Management: Managing Your Internal ReleasesJoshua Hoskins
 
Building einstein analytics apps uk-compressed
Building einstein analytics apps   uk-compressedBuilding einstein analytics apps   uk-compressed
Building einstein analytics apps uk-compressedrikkehovgaard
 
Build Together And Deliver Continuously With Salesforce DX
Build Together And Deliver Continuously With Salesforce DXBuild Together And Deliver Continuously With Salesforce DX
Build Together And Deliver Continuously With Salesforce DXLynette Lim
 
Visualforce Hack for Junction Objects
Visualforce Hack for Junction ObjectsVisualforce Hack for Junction Objects
Visualforce Hack for Junction ObjectsRitesh Aswaney
 
AngularJS App In Two Weeks
AngularJS App In Two WeeksAngularJS App In Two Weeks
AngularJS App In Two WeeksPeter Chittum
 

Similaire à JavaScript Unit Testing (20)

Force.com Friday : Intro to Apex
Force.com Friday : Intro to Apex Force.com Friday : Intro to Apex
Force.com Friday : Intro to Apex
 
NgForce: A JS Library For Quickly Building Salesforce Apps Using AngularJS
NgForce: A JS Library For Quickly Building Salesforce Apps Using AngularJSNgForce: A JS Library For Quickly Building Salesforce Apps Using AngularJS
NgForce: A JS Library For Quickly Building Salesforce Apps Using AngularJS
 
Einstein Analytics for Developers
Einstein Analytics for DevelopersEinstein Analytics for Developers
Einstein Analytics for Developers
 
Force.com Friday - Intro to Visualforce
Force.com Friday - Intro to VisualforceForce.com Friday - Intro to Visualforce
Force.com Friday - Intro to Visualforce
 
Building Complex Traversing & Branching Apps Using Visual Workflows and Apex
Building Complex Traversing & Branching Apps Using Visual Workflows and ApexBuilding Complex Traversing & Branching Apps Using Visual Workflows and Apex
Building Complex Traversing & Branching Apps Using Visual Workflows and Apex
 
Intro to Apex - Salesforce Force Friday Webinar
Intro to Apex - Salesforce Force Friday Webinar Intro to Apex - Salesforce Force Friday Webinar
Intro to Apex - Salesforce Force Friday Webinar
 
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 Visualforce (May 8, 2015)
Force.com Friday: Intro to Visualforce (May 8, 2015)Force.com Friday: Intro to Visualforce (May 8, 2015)
Force.com Friday: Intro to Visualforce (May 8, 2015)
 
Dreamforce 2014 - Salesforce Python SDK for REST/SOAP APIs
Dreamforce 2014 - Salesforce Python SDK for REST/SOAP APIsDreamforce 2014 - Salesforce Python SDK for REST/SOAP APIs
Dreamforce 2014 - Salesforce Python SDK for REST/SOAP APIs
 
Spring '14 Release Developer Preview Webinar
Spring '14 Release Developer Preview WebinarSpring '14 Release Developer Preview Webinar
Spring '14 Release Developer Preview Webinar
 
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
 
Salesforce – Proven Platform Development with DevOps & Agile
Salesforce – Proven Platform Development with DevOps & AgileSalesforce – Proven Platform Development with DevOps & Agile
Salesforce – Proven Platform Development with DevOps & Agile
 
All Aboard the Lightning Components Action Service
All Aboard the Lightning Components Action ServiceAll Aboard the Lightning Components Action Service
All Aboard the Lightning Components Action Service
 
Staying Ahead of the Curve with Lightning - Snowforce16 Keynote
Staying Ahead of the Curve with Lightning - Snowforce16 KeynoteStaying Ahead of the Curve with Lightning - Snowforce16 Keynote
Staying Ahead of the Curve with Lightning - Snowforce16 Keynote
 
Release Management: Managing Your Internal Releases
Release Management: Managing Your Internal ReleasesRelease Management: Managing Your Internal Releases
Release Management: Managing Your Internal Releases
 
Development Best Practices
Development Best PracticesDevelopment Best Practices
Development Best Practices
 
Building einstein analytics apps uk-compressed
Building einstein analytics apps   uk-compressedBuilding einstein analytics apps   uk-compressed
Building einstein analytics apps uk-compressed
 
Build Together And Deliver Continuously With Salesforce DX
Build Together And Deliver Continuously With Salesforce DXBuild Together And Deliver Continuously With Salesforce DX
Build Together And Deliver Continuously With Salesforce DX
 
Visualforce Hack for Junction Objects
Visualforce Hack for Junction ObjectsVisualforce Hack for Junction Objects
Visualforce Hack for Junction Objects
 
AngularJS App In Two Weeks
AngularJS App In Two WeeksAngularJS App In Two Weeks
AngularJS App In Two Weeks
 

Plus de Keir Bowden

LC 2022 - Second Generation Packaging
LC 2022 - Second Generation PackagingLC 2022 - Second Generation Packaging
LC 2022 - Second Generation PackagingKeir Bowden
 
Mutation Testing.pdf
Mutation Testing.pdfMutation Testing.pdf
Mutation Testing.pdfKeir Bowden
 
London Non-Profit Spring 22 Salesforce Release
London Non-Profit Spring 22 Salesforce ReleaseLondon Non-Profit Spring 22 Salesforce Release
London Non-Profit Spring 22 Salesforce ReleaseKeir Bowden
 
London Salesforce Developer January 2022
London Salesforce Developer January 2022London Salesforce Developer January 2022
London Salesforce Developer January 2022Keir Bowden
 
Winter 22 for Developers
Winter 22 for DevelopersWinter 22 for Developers
Winter 22 for DevelopersKeir Bowden
 
Londons Calling 2021
Londons Calling 2021Londons Calling 2021
Londons Calling 2021Keir Bowden
 
London Salesforce Developers TDX 20 Global Gathering
London Salesforce Developers TDX 20 Global GatheringLondon Salesforce Developers TDX 20 Global Gathering
London Salesforce Developers TDX 20 Global GatheringKeir Bowden
 
Helsinki developer group march 2020
Helsinki developer group march 2020Helsinki developer group march 2020
Helsinki developer group march 2020Keir Bowden
 
London's calling 2020 Documentor Plug-In
London's calling 2020 Documentor Plug-InLondon's calling 2020 Documentor Plug-In
London's calling 2020 Documentor Plug-InKeir Bowden
 
Lightning User Interface Testing with Selenium and Node JS
Lightning User Interface Testing with Selenium and Node JSLightning User Interface Testing with Selenium and Node JS
Lightning User Interface Testing with Selenium and Node JSKeir Bowden
 
Salesforce CLI Cheat Sheet
Salesforce CLI Cheat Sheet Salesforce CLI Cheat Sheet
Salesforce CLI Cheat Sheet Keir Bowden
 
Salesforce Spring 19 release top 10 Features
Salesforce Spring 19 release top 10 FeaturesSalesforce Spring 19 release top 10 Features
Salesforce Spring 19 release top 10 FeaturesKeir Bowden
 
UI Testing with Selenium and Node - London's Calling 2019
UI Testing with Selenium and Node - London's Calling 2019UI Testing with Selenium and Node - London's Calling 2019
UI Testing with Selenium and Node - London's Calling 2019Keir Bowden
 
Salesforce Winter 19 release top 10 features
Salesforce Winter 19 release top 10 featuresSalesforce Winter 19 release top 10 features
Salesforce Winter 19 release top 10 featuresKeir Bowden
 
Quickstart Templates with the Salesforce CLI
Quickstart Templates with the Salesforce CLIQuickstart Templates with the Salesforce CLI
Quickstart Templates with the Salesforce CLIKeir Bowden
 
TrailheaDX Global Gathering London 2018
TrailheaDX Global Gathering London 2018TrailheaDX Global Gathering London 2018
TrailheaDX Global Gathering London 2018Keir Bowden
 
Getting started with public speaking
Getting started with public speakingGetting started with public speaking
Getting started with public speakingKeir Bowden
 
London's Calling 2018 - No Connection, No Problem
London's Calling 2018 - No Connection, No ProblemLondon's Calling 2018 - No Connection, No Problem
London's Calling 2018 - No Connection, No ProblemKeir Bowden
 
No Connection? No Problem!
No Connection? No Problem!No Connection? No Problem!
No Connection? No Problem!Keir Bowden
 

Plus de Keir Bowden (20)

LC 2022 - Second Generation Packaging
LC 2022 - Second Generation PackagingLC 2022 - Second Generation Packaging
LC 2022 - Second Generation Packaging
 
Mutation Testing.pdf
Mutation Testing.pdfMutation Testing.pdf
Mutation Testing.pdf
 
London Non-Profit Spring 22 Salesforce Release
London Non-Profit Spring 22 Salesforce ReleaseLondon Non-Profit Spring 22 Salesforce Release
London Non-Profit Spring 22 Salesforce Release
 
London Salesforce Developer January 2022
London Salesforce Developer January 2022London Salesforce Developer January 2022
London Salesforce Developer January 2022
 
Winter 22 for Developers
Winter 22 for DevelopersWinter 22 for Developers
Winter 22 for Developers
 
Londons Calling 2021
Londons Calling 2021Londons Calling 2021
Londons Calling 2021
 
London Salesforce Developers TDX 20 Global Gathering
London Salesforce Developers TDX 20 Global GatheringLondon Salesforce Developers TDX 20 Global Gathering
London Salesforce Developers TDX 20 Global Gathering
 
Helsinki developer group march 2020
Helsinki developer group march 2020Helsinki developer group march 2020
Helsinki developer group march 2020
 
London's calling 2020 Documentor Plug-In
London's calling 2020 Documentor Plug-InLondon's calling 2020 Documentor Plug-In
London's calling 2020 Documentor Plug-In
 
Lightning User Interface Testing with Selenium and Node JS
Lightning User Interface Testing with Selenium and Node JSLightning User Interface Testing with Selenium and Node JS
Lightning User Interface Testing with Selenium and Node JS
 
Salesforce CLI Cheat Sheet
Salesforce CLI Cheat Sheet Salesforce CLI Cheat Sheet
Salesforce CLI Cheat Sheet
 
Salesforce Spring 19 release top 10 Features
Salesforce Spring 19 release top 10 FeaturesSalesforce Spring 19 release top 10 Features
Salesforce Spring 19 release top 10 Features
 
UI Testing with Selenium and Node - London's Calling 2019
UI Testing with Selenium and Node - London's Calling 2019UI Testing with Selenium and Node - London's Calling 2019
UI Testing with Selenium and Node - London's Calling 2019
 
Salesforce Winter 19 release top 10 features
Salesforce Winter 19 release top 10 featuresSalesforce Winter 19 release top 10 features
Salesforce Winter 19 release top 10 features
 
Quickstart Templates with the Salesforce CLI
Quickstart Templates with the Salesforce CLIQuickstart Templates with the Salesforce CLI
Quickstart Templates with the Salesforce CLI
 
TrailheaDX Global Gathering London 2018
TrailheaDX Global Gathering London 2018TrailheaDX Global Gathering London 2018
TrailheaDX Global Gathering London 2018
 
Getting started with public speaking
Getting started with public speakingGetting started with public speaking
Getting started with public speaking
 
Salesforce CLI
Salesforce CLISalesforce CLI
Salesforce CLI
 
London's Calling 2018 - No Connection, No Problem
London's Calling 2018 - No Connection, No ProblemLondon's Calling 2018 - No Connection, No Problem
London's Calling 2018 - No Connection, No Problem
 
No Connection? No Problem!
No Connection? No Problem!No Connection? No Problem!
No Connection? No Problem!
 

Dernier

SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predieusebiomeyer
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa494f574xmv
 
Elevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New OrleansElevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New Orleanscorenetworkseo
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMartaLoveguard
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书zdzoqco
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一z xss
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhimiss dipika
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)Christopher H Felton
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Paul Calvano
 
Intellectual property rightsand its types.pptx
Intellectual property rightsand its types.pptxIntellectual property rightsand its types.pptx
Intellectual property rightsand its types.pptxBipin Adhikari
 
Q4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxQ4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxeditsforyah
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Excelmac1
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationLinaWolf1
 
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书rnrncn29
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Sonam Pathan
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一Fs
 

Dernier (20)

SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predi
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa
 
Elevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New OrleansElevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New Orleans
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptx
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhi
 
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
 
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24
 
Intellectual property rightsand its types.pptx
Intellectual property rightsand its types.pptxIntellectual property rightsand its types.pptx
Intellectual property rightsand its types.pptx
 
Q4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxQ4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptx
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 Documentation
 
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
 
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
 

JavaScript Unit Testing

  • 3. Safe Harbor Safe harbor statement under the Private Securities Litigation Reform Act of 1995: 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 intellectual property and other litigation, risks associated with 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-Q for the most recent fiscal quarter ended July 31, 2012. This 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.
  • 4. Agenda • Introduction • Tools • Visualforce • Lightning Components • Q & A
  • 6. Introduction • Why write unit tests? – Give confidence – Reduce cost of bugs – Produce testable code – Promote refactoring
  • 7. JavaScript on Salesforce Challenges • No test context for client – Changes aren’t rolled back • Side effects: – DOM manipulation – Server calls
  • 8. Techniques • Write testable code – Unobtrusive JavaScript – Avoid anonymous functions – Functional decomposition • Functions to decide on action • Functions to take the action function redirectToURL(url) { if (“#”===url.charAt(0)) { window.location.hash=url; } else if (“/”===url.charAt(0)) window.location.pathname=url; } ....
  • 10. Tools
  • 11. QUnit • Pure JavaScript Unit Test Framework • Executes in-browser • From the developers of jQuery <apex:includeScript value="{!$Resource.qunitJS}"/> <apex:stylesheet value="{!$Resource.qunitCSS}"/> <div id="qunit"></div> <div id="qunit-fixture"></div> Test markup container
  • 12. QUnit • Module – group of tests • Test – single test • Assert – confirm behaviour QUnit.module("JOBLIST", { beforeEach: function(assert) { // setup code }, afterEach : function(assert) { // teardown code } }); QUnit.test("Show Progress", function( assert ) { jobCtrl.showProgress(); }); assert.equal(jobCtrl.progressCount, 1, "Progress count is one");
  • 13. Sinon.JS • Pure JavaScript • Works with any test framework • Three elements: – Spies – records execution, parameters – Stubs – Spies + replace functions – Mocks – Stubs + expected behaviour
  • 14. Sinon Stub this.searchStub = sinon.stub(jobCtrl, "doSearch"); var jobCtrl={ doSearch : function(ev) { // remote call to server } }; jobCtrl.doSearch(event); doSearch : function() { // sinon stub code } assert.equal(this.searchStub.callCount,1, "search called once"); this.searchStub.restore(); doSearch : function(ev) { // remote call to server } $('#searchbtn').on("click", jobCtrl.doSearch);
  • 15. Blanket.js • Code coverage! • Pure JavaScript • Works with QUnit, Mocha and Jasmine • JavaScript must be external <apex:includeScript value="{!$Resource.blanketJS}"/> <script src="{!$Resource.JobsJS}" data-cover="true"></script>
  • 18. Visualforce • Dedicated test page • Replicate markup as required • Include JavaScript to be tested • Can capture coverage • Demo
  • 20. Challenges • Components are isolated • JavaScript in controller + helper • Cannot capture coverage • Markup is fixed • How to trigger tests?
  • 21. My Solution • QUnit tests in helper function • Controller method to execute helper function • Lightning test application (equivalent to page) • Tests executed via event – Fired by application – Handled by component under test • Demo