SlideShare a Scribd company logo
1 of 24
Download to read offline
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

What's hot

What's hot (20)

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

Similar to Quality assurance for javascript

Gradle - time for a new build
Gradle - time for a new buildGradle - time for a new build
Gradle - time for a new build
Igor Khotin
 
MS Cloud Day - Deploying and monitoring windows azure applications
MS Cloud Day - Deploying and monitoring windows azure applicationsMS Cloud Day - Deploying and monitoring windows azure applications
MS Cloud Day - Deploying and monitoring windows azure applications
Spiffy
 

Similar to Quality assurance for javascript (20)

Maven
MavenMaven
Maven
 
Behavior Driven Development by Example
Behavior Driven Development by ExampleBehavior Driven Development by Example
Behavior Driven Development by Example
 
Gradle - time for a new build
Gradle - time for a new buildGradle - time for a new build
Gradle - time for a new build
 
Grunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous IntegrationGrunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous Integration
 
Towards Continuous Deployment with Django
Towards Continuous Deployment with DjangoTowards Continuous Deployment with Django
Towards Continuous Deployment with Django
 
JavaScript Unit Testing
JavaScript Unit TestingJavaScript Unit Testing
JavaScript Unit Testing
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
VueJs Workshop
VueJs WorkshopVueJs Workshop
VueJs Workshop
 
A Glance At The Java Performance Toolbox
 A Glance At The Java Performance Toolbox A Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
Unit Testing in AngularJS - CC FE & UX
Unit Testing in AngularJS -  CC FE & UXUnit Testing in AngularJS -  CC FE & UX
Unit Testing in AngularJS - CC FE & UX
 
Java Build Tools
Java Build ToolsJava Build Tools
Java Build Tools
 
Javascript ui for rest services
Javascript ui for rest servicesJavascript ui for rest services
Javascript ui for rest services
 
Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...
Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...
Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with Gradle
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with Gradle
 
A Glance At The Java Performance Toolbox.pdf
 A Glance At The Java Performance Toolbox.pdf A Glance At The Java Performance Toolbox.pdf
A Glance At The Java Performance Toolbox.pdf
 
A Glance At The Java Performance Toolbox.pdf
 A Glance At The Java Performance Toolbox.pdf A Glance At The Java Performance Toolbox.pdf
A Glance At The Java Performance Toolbox.pdf
 
Configuration Management and Transforming Legacy Applications in the Enterpri...
Configuration Management and Transforming Legacy Applications in the Enterpri...Configuration Management and Transforming Legacy Applications in the Enterpri...
Configuration Management and Transforming Legacy Applications in the Enterpri...
 
Cloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
Cloud-powered Continuous Integration and Deployment architectures - Jinesh VariaCloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
Cloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
 
MS Cloud Day - Deploying and monitoring windows azure applications
MS Cloud Day - Deploying and monitoring windows azure applicationsMS Cloud Day - Deploying and monitoring windows azure applications
MS Cloud Day - Deploying and monitoring windows azure applications
 

Quality assurance for javascript