SlideShare a Scribd company logo
Quality Assurance for JavaScript
Contact me: hadoope@gmail.com
Outline
 Server Side Javascript
 Environment Preparation
 Static Check & Unit Test
NodeJs
 Javascript is a frontend programming language,
but things have changed...
Server Side Javascript
 Server Side Javascript needs:
 Package management and Modular
 Task Management Tools, like maven in java;
 Quality Assurance Utilities
− Static Check
− Unit Test
Writing Modular JavaScript
 Modularity
 AMD: Asynchronous Module Definition
define(
module_id /*optional*/,
[dependencies] /*optional*/,
definition function /*function for instantiating the module or object*/
);
Package Management
NPM is short for Node Packaged Modules.
Grunt.js
 Why a build tool is needed for CI ?
 Why Grunt.js
Basic Grunt.js tasks
 init
Generate project scaffolding from a predefined template
 lint
validate files with jshint
 min
minify files with UglifyJS
 server
Start a static node web server
 test
Run unit tests with nodeunit. (Jasmine support)
Outline
 Server Side Javascript
 Environment Preparation
 Static Check & Unit Test
Install NodeJs
 Install via source code
 Download from
nodejs.org/download
 ./configure & make & make install
 Install via package manager
su -c 'yum install npm'
 Dependencies
 V8 Javascript Engine
Install Related Modules
 npm install -g grunt-cli
 npm install -g grunt-contrib-jshint
 npm install -g grunt-mocha-
phantomjs
Grunt Configuration
Outline
 Server Side Javascript
 Environment Preparation
 Static Check & Unit Test
Static Check via JSHint
mpt comes from
Gruntfile.js
Unit Test via
Mocha
 Feature Rich
 Runs on node + the browser
 Simplifies async testing
 Growl notifications
 Choose your own assertion library
Chai
 BDD / TDD
 For node + the browser
 Three assertion styles
 should - foo.should.be.a('string')
 expect - expect(foo).to.be.a('string')
 assert - assert.typeOf(foo,'string')
Sample: TableRender.html
Sample: TableRender.js (1)
Sample: TableRender.js (2)
Unit Tests via Grunt
Reference
 http://addyosmani.com/writing-modular-js/
 http://www.slideshare.net/FabienDoiron/grunt-js
 http://www.slideshare.net/jamescryer/javascript-
testing-mocha-chai
 http://visionmedia.github.io/mocha/
 http://chaijs.com/
Quality assurance for javascript

More Related Content

PPTX
#2 Hanoi Magento Meetup - Part 2: Knockout JS
PDF
PDF
Angular + JHipster - JHipster Conf
PPTX
#3 Hanoi Magento Meetup - Part 2: Scalable Magento Development With Containers
PPTX
Building Massive AngularJS Apps
PPTX
Cpsc 473 01 lightning talk
PDF
StripeCon EU 2018 - SilverStripe 4 application framework
PDF
Webdriver.io
#2 Hanoi Magento Meetup - Part 2: Knockout JS
Angular + JHipster - JHipster Conf
#3 Hanoi Magento Meetup - Part 2: Scalable Magento Development With Containers
Building Massive AngularJS Apps
Cpsc 473 01 lightning talk
StripeCon EU 2018 - SilverStripe 4 application framework
Webdriver.io

What's hot (20)

PDF
Griffon: Swing just got fun again
PPTX
Grunt Continuous Development of the Front End Tier
PDF
Pre-render Blazor WebAssembly on static web hosting at publishing time
ODP
[Nuxeo World 2013] XML EXTENSION POINT COMPLETION IN NUXEO IDE - SUN TAN, SERLI
PDF
Viktor Turskyi "Effective NodeJS Application Development"
PPTX
React - поглянемо по іншому на V в MVC
PPTX
前端網頁自動測試
PPTX
Javascript and DOM
PDF
Nuxeo and JavaScript
PDF
Frontend Build Tools - CC FE & UX
PDF
Building Isomorphic JavaScript Apps - NDC 2015
PPTX
Packing for the Web with Webpack
PPTX
Full stack web development with c# and web assembly - Blazor.Net
PDF
WebGL의 무궁무진한 가능성
PPTX
An Overview on Nuxt.js
PDF
Webpack & React Performance in 16+ Steps
PDF
SOAP calls in Clojure application
PPTX
WebdriverIO: the Swiss Army Knife of testing
PDF
Webdriver io presentation
Griffon: Swing just got fun again
Grunt Continuous Development of the Front End Tier
Pre-render Blazor WebAssembly on static web hosting at publishing time
[Nuxeo World 2013] XML EXTENSION POINT COMPLETION IN NUXEO IDE - SUN TAN, SERLI
Viktor Turskyi "Effective NodeJS Application Development"
React - поглянемо по іншому на V в MVC
前端網頁自動測試
Javascript and DOM
Nuxeo and JavaScript
Frontend Build Tools - CC FE & UX
Building Isomorphic JavaScript Apps - NDC 2015
Packing for the Web with Webpack
Full stack web development with c# and web assembly - Blazor.Net
WebGL의 무궁무진한 가능성
An Overview on Nuxt.js
Webpack & React Performance in 16+ Steps
SOAP calls in Clojure application
WebdriverIO: the Swiss Army Knife of testing
Webdriver io presentation
Ad

Similar to Quality assurance for javascript (20)

PPTX
Node.js Dublin Meetup April 2014
DOCX
Brad Enterprise Solution Architect
PDF
JavaScript development methodology
PPTX
Mini-Training: Node.js
PDF
(Ebook) JavaScript Application Design: A Build First Approach by Nicolas Be...
PPTX
T4T Training day - NodeJS
PDF
Grunt.js and Yeoman, Continous Integration
PDF
3 WAYS TO TEST YOUR COLDFUSION API
PDF
3 WAYS TO TEST YOUR COLDFUSION API -
PDF
Testing Strategies for Node.pdf
PDF
Learning Nodejs For Net Developers Harry Cummings
PPT
Introduction to JavaScript Full Stack
PDF
JavaScript Modules Done Right
PPTX
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
PPTX
Irfan maulana nodejs web development
PPTX
PHP Indonesia - Nodejs Web Development
PPTX
How do I write Testable Javascript so I can Test my CF API on Server and Client
PDF
2015 - Introduction to building enterprise web applications using Angular.js
PDF
Java vs. Java Script for enterprise web applications - Chris Bailey
PDF
JavaScript Application Design A Build First Approach 1st Edition Nicolas Beva...
Node.js Dublin Meetup April 2014
Brad Enterprise Solution Architect
JavaScript development methodology
Mini-Training: Node.js
(Ebook) JavaScript Application Design: A Build First Approach by Nicolas Be...
T4T Training day - NodeJS
Grunt.js and Yeoman, Continous Integration
3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API -
Testing Strategies for Node.pdf
Learning Nodejs For Net Developers Harry Cummings
Introduction to JavaScript Full Stack
JavaScript Modules Done Right
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
Irfan maulana nodejs web development
PHP Indonesia - Nodejs Web Development
How do I write Testable Javascript so I can Test my CF API on Server and Client
2015 - Introduction to building enterprise web applications using Angular.js
Java vs. Java Script for enterprise web applications - Chris Bailey
JavaScript Application Design A Build First Approach 1st Edition Nicolas Beva...
Ad

Quality assurance for javascript