18
Continuous Integration of JS and Apex code using Jasmine, Phantom.JS and Drone.io Kevin Poorman Principle Architect @CodeFriar

Ci of js and apex using jasmine, phantom js and drone io df14

Embed Size (px)

Citation preview

Page 1: Ci of js and apex using jasmine, phantom js and drone io   df14

Continuous Integration of JS and Apex code using Jasmine, Phantom.JS and Drone.ioKevin Poorman

Principle Architect

@CodeFriar

Page 2: Ci of js and apex using jasmine, phantom js and drone io   df14

Place

Customer or

Partner logo in

white area of

slide, centered

Kevin PoormanPrincipal Architect

Page 3: Ci of js and apex using jasmine, phantom js and drone io   df14

•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

Page 4: Ci of js and apex using jasmine, phantom js and drone io   df14

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/

Page 5: Ci of js and apex using jasmine, phantom js and drone io   df14

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

Page 6: Ci of js and apex using jasmine, phantom js and drone io   df14

Use to

introduce a

demo, video,

Q&A, etc.

CI is only as good as the tests you write.

Introduction to Continuous Integration

Page 7: Ci of js and apex using jasmine, phantom js and drone io   df14

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.

Page 8: Ci of js and apex using jasmine, phantom js and drone io   df14

Introduction to Continuous Delivery

Merge Githook triggers Drone.io build

Build script execution

Deploy to 1 or more Environments

Page 9: Ci of js and apex using jasmine, phantom js and drone io   df14

•Grunt – gruntjs.com

•Drone.Io – drone.io

•Jasmine – jasmine.github.io

•Instanbul – gotwarlost.github.io/istanbul

•Ant – ant.apache.org

Our Opinionated Stack.

Page 10: Ci of js and apex using jasmine, phantom js and drone io   df14

The Players: Grunt

•Javascript based Task runner.

•Wealth of community contributed Plugins.

–Examples include: cssmin, copy, jasmine, ant-

sfdc

Page 11: Ci of js and apex using jasmine, phantom js and drone io   df14

The Players: Drone.io

•Docker based CI as a service app

•Polyglot language support.

•Automatic integration with Github and Bitbucket

Page 12: Ci of js and apex using jasmine, phantom js and drone io   df14

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!

Page 13: Ci of js and apex using jasmine, phantom js and drone io   df14

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

Page 14: Ci of js and apex using jasmine, phantom js and drone io   df14

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.

Page 15: Ci of js and apex using jasmine, phantom js and drone io   df14

Use to

introduce a

demo, video,

Q&A, etc. Show me the code!

Putting it all together

Page 16: Ci of js and apex using jasmine, phantom js and drone io   df14

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

Page 17: Ci of js and apex using jasmine, phantom js and drone io   df14

Use to

introduce a

demo, video,

Q&A, etc. Questions & AnswersIf you don’t ask questions … I will.

Questions & Answers

Page 18: Ci of js and apex using jasmine, phantom js and drone io   df14

Github Repo: noeticpenguin/df14

Twitter me: @codefriar