34
TDD WITH ANGULARJS SIRAR SALIH SOFTWARE ENGINEER

Test Driven Development with AngularJS

Embed Size (px)

DESCRIPTION

TDD with Google's JavaScript framework, AngularJS.

Citation preview

Page 1: Test Driven Development with AngularJS

TDD WITH ANGULARJS

SIRAR SALIH

SOFTWARE ENGINEER

Page 2: Test Driven Development with AngularJS

About me

Page 3: Test Driven Development with AngularJS

HTML enhanced for web apps!

Page 4: Test Driven Development with AngularJS
Page 5: Test Driven Development with AngularJS

GET (once)

POST (later)

From wikipedia

Page 6: Test Driven Development with AngularJS

• Directives– Powerful, Angular-only feature– Simplify DOM manipulation by reusable custom functionality

• Data binding– Models

• Controllers– Behavior– Avoid DOM manipulation

• Form validation– Easy client-side validation

• Localization– Filter directives

• Testability– Designed to be testable– Easy dependency injection

• +++

Page 7: Test Driven Development with AngularJS

• Module– Sub-modules

Page 8: Test Driven Development with AngularJS

• Controller

Page 9: Test Driven Development with AngularJS

• Directive

Page 10: Test Driven Development with AngularJS

• Service– Data

Page 11: Test Driven Development with AngularJS

• Service– Data

Page 12: Test Driven Development with AngularJS

«With great power, comes great responsibility.» – Uncle Ben

Page 13: Test Driven Development with AngularJS

Test Driving AngularJS

Page 14: Test Driven Development with AngularJS

«With great power, comes great responsibility.» – Uncle Ben

Page 15: Test Driven Development with AngularJS

«With great power, comes great responsibility.» – Uncle Ben

• Jasmine

Page 16: Test Driven Development with AngularJS

«With great power, comes great responsibility.» – Uncle Ben

• Jasmine

Page 17: Test Driven Development with AngularJS

«With great power, comes great responsibility.» – Uncle Ben

• Jasmine

Page 18: Test Driven Development with AngularJS

«With great power, comes great responsibility.» – Uncle Ben

• Karma test runner

Page 19: Test Driven Development with AngularJS

«With great power, comes great responsibility.» – Uncle Ben

• Karma test runner

Page 20: Test Driven Development with AngularJS

«With great power, comes great responsibility.» – Uncle Ben

• Karma coverage (Istanbul plugin)

Page 21: Test Driven Development with AngularJS

«With great power, comes great responsibility.» – Uncle Ben

• Karma coverage (Istanbul plugin)

Page 22: Test Driven Development with AngularJS

Demo time!

Page 23: Test Driven Development with AngularJS

Test Automation

«With great power, comes great responsibility.» – Uncle Ben

Page 24: Test Driven Development with AngularJS

«With great power, comes great responsibility.» – Uncle Ben

• Grunt

Page 25: Test Driven Development with AngularJS

«With great power, comes great responsibility.» – Uncle Ben

• Karma TeamCity (TeamCity plugin)

Page 26: Test Driven Development with AngularJS

«With great power, comes great responsibility.» – Uncle Ben

• Karma TeamCity (TeamCity plugin)

Page 27: Test Driven Development with AngularJS

«With great power, comes great responsibility.» – Uncle Ben

• Karma TeamCity (TeamCity plugin)

Page 28: Test Driven Development with AngularJS

«With great power, comes great responsibility.» – Uncle Ben

• Karma coverage (Istanbul plugin)

Page 29: Test Driven Development with AngularJS

Best Practices

Page 30: Test Driven Development with AngularJS

Naming Conventions

• File naming– mainCtrl.js– mainSvc.js– mainDirective.js

• JavaScript – mainController– mainService– mainDirective

• HTML– <main-directive></main-directive>

Page 31: Test Driven Development with AngularJS

Design Patterns

• Feature Pattern– Break into feature folders

Page 32: Test Driven Development with AngularJS

Design Patterns

• Enterprise Pattern– Break into component folders

Page 33: Test Driven Development with AngularJS

Design Patterns

• App Pattern– Break into module folders

Page 34: Test Driven Development with AngularJS

Thank you / Questions?

Blog: http://sirars.com/ • [email protected] / [email protected]• @SirarSalih