10
TEST DRIVEN DEVELOPMENT IN JAVASCRIPT Presented by Asutosh Dash

All you need for TDD in JavaScript

Embed Size (px)

DESCRIPTION

This slide gives an idea of TDD(Test Driven Development), BDD(Behavioral Driven Development ) and the tools that you need for doing it in JavaScript

Citation preview

Page 1: All you need for TDD  in JavaScript

TEST DRIVENDEVELOPMENT

IN JAVASCRIPTPresented by Asutosh Dash

Page 2: All you need for TDD  in JavaScript

KEY BENEFITS OF TDDYAGNI You aren't gonna need itIt's an extreme programming methodology which is intendedto improve software quality

DRY Don't repeat yourselfSOLID Principles

Page 3: All you need for TDD  in JavaScript

BDDFeature driven approach to TDD

Page 4: All you need for TDD  in JavaScript

FEATURE DRIVEN APPROACH TO TDDWrite a test (Defining desired behaviors of the program)Write as much as code to make the test pass(implement thebehaviour)Refactor the codeTest again (Verify phase)

Page 5: All you need for TDD  in JavaScript

JASMINETo do BDD in JavaScriptCapability of test suite and test casesMocking capabilities are excellentSpying a function/methodIt does not require HTML/DOMRunning Jasmine (through Maven [Jasmine MavenPlugin]/Grunt [grunt jasmine]).

Page 6: All you need for TDD  in JavaScript

KARMA - TEST RUNNERCreates HTTP server to run your tests localy.Test your code on real browsers (Chrome. Safari, Firefox andIE)Can be easily integrated with AngularJs, BackboneJs, Emberjs,ReactJsHave good support for IDE WebStorm

Page 7: All you need for TDD  in JavaScript

KARMA CONFIGURATIONmodule.exports=function(config){ config.set({ frameworks:['jasmine'], files:['scripts/*.js','tests/*.js'], reporters: ['progress', 'coverage'], preprocessors:{ 'scripts/*.js':['coverage'] }, coverageReporter: { type : 'html', dir : 'coverage/' } }); };

Page 8: All you need for TDD  in JavaScript

ISATNBULA JS code coverage tool

Can run in command line and as well as libraryReport format: HTML, LCOV and CoberturaWell tested in node

Page 10: All you need for TDD  in JavaScript

THANK YOUBY ASUTOSH DASH