Upload
kevin-poorman
View
179
Download
0
Embed Size (px)
Citation preview
Continuous Integration of JS and Apex code using Jasmine, Phantom.JS and Drone.ioKevin Poorman
Principle Architect
@CodeFriar
Place
Customer or
Partner logo in
white area of
slide, centered
Kevin PoormanPrincipal Architect
•Example build file
•Example Grunt file
•Recap
•Q & A
Agenda
•Introduction to CI and CD
•The (Opinionated) Stack
•Meet the players
•Putting it all together
Introduction to Continuous Integration
•CI is the process of:
–Merging code
–Testing code
–Automatically!
• CI presumes:
– Version Control
–Test driven Development
– Coherent branching and
merging strategy
• For instance: Git flow:
http://nvie.com/posts/a-
successful-git-
branching-model/
Introduction to Continuous Integration
Code Committed to fork or branch
Git commit hook triggers Ci build
Build script execution
Code Merged
Optionally re-run
tests on master
branch
Use to
introduce a
demo, video,
Q&A, etc.
CI is only as good as the tests you write.
Introduction to Continuous Integration
Introduction to Continuous Delivery
•CD is the process of
deploying successful
code changes to
runtime environments
automatically.
•CD almost never goes
to Production Orgs:
•Instead push from dev
org to Q/A Orgs or
Packaging Orgs.
Introduction to Continuous Delivery
Merge Githook triggers Drone.io build
Build script execution
Deploy to 1 or more Environments
•Grunt – gruntjs.com
•Drone.Io – drone.io
•Jasmine – jasmine.github.io
•Instanbul – gotwarlost.github.io/istanbul
•Ant – ant.apache.org
Our Opinionated Stack.
The Players: Grunt
•Javascript based Task runner.
•Wealth of community contributed Plugins.
–Examples include: cssmin, copy, jasmine, ant-
sfdc
The Players: Drone.io
•Docker based CI as a service app
•Polyglot language support.
•Automatic integration with Github and Bitbucket
The Players: Jasmine
•Behavior driven development testing framework
for Javascript.
•Many frameworks supported. (Angular, Backbone)
•Uses Phantom.js (Headless Chrome based
browser)
–Can be used in any browser!
–Or multiple browsers!
The Players: Istanbul
•Code coverage reports for Jasmine / Javascript
testing.
•Optional “meta” tests for Minimum code coverage
based on branch execution, % of Lines, % of
Methods etc.
•Outputs both LCOV and .html files
The Players: Ant
•Similar to Grunt, ANT is a XML based Task runner
commonly used in the Java world.
•Salesforce provides the Ant Migration Toolkit, a
plugin for Ant that facilitates retrieving and
deploying metadata and code to Salesforce Orgs.
Use to
introduce a
demo, video,
Q&A, etc. Show me the code!
Putting it all together
Recap:
•We use CI to automatically run tests on our Js and Apex Code just after commit/merge.
•We use CD to deploy that new code to our Dev and Q/a Orgs
•Jasmine for JS testing
•Ant for Apex tests and
deploying to Orgs
•Grunt to define our
tasks
•Drone.io to automate
Use to
introduce a
demo, video,
Q&A, etc. Questions & AnswersIf you don’t ask questions … I will.
Questions & Answers
Github Repo: noeticpenguin/df14
Twitter me: @codefriar