testable web applications with angularjs and nodejs

28
Testable Web Applications With AngularJS and NodeJS Presented by Greg Burke Web Application Developer – FPI greg.burke@financialpartn ers.com

Upload: annot

Post on 23-Feb-2016

81 views

Category:

Documents


0 download

DESCRIPTION

Testable Web Applications With AngularJS and NodeJS. Presented by Greg Burke Web Application Developer – FPI [email protected]. Angular and Node. Angular JS: comprehensive MV * framework Contains the building blocks for a SPA Node JS: server-side Javascript - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Testable Web Applications With  AngularJS  and  NodeJS

Testable Web Applications With AngularJS and NodeJS

Presented by Greg BurkeWeb Application Developer – FPI

[email protected]

Page 2: Testable Web Applications With  AngularJS  and  NodeJS

Angular and Node

• Angular JS: comprehensive MV* framework• Contains the building blocks for a SPA• Node JS: server-side Javascript• Web server, test runner

Page 3: Testable Web Applications With  AngularJS  and  NodeJS

Outline

• Brainstorm• Overview of SPA• Problems• Framework Discussion• Angular Demo• Testing Demo• Other topics in Node/Angular

Page 4: Testable Web Applications With  AngularJS  and  NodeJS

Brainstorming

• Discuss the different elements needed in order to build a large enterprise application

Page 5: Testable Web Applications With  AngularJS  and  NodeJS

Considerations

• SPA?• MV*?• Controls?• Module loading?• Unit Testing?

Page 6: Testable Web Applications With  AngularJS  and  NodeJS

SPA

• Only one true “page”• Multiple “views”• Async requests• Need to handle back button and navigable

views• Sammy.js, JQuery AJAX, Amplify• Demo

Page 7: Testable Web Applications With  AngularJS  and  NodeJS

MV*

• Separation of concerns• Two-way data-binding• Knockout.js, Backbone.js

Page 8: Testable Web Applications With  AngularJS  and  NodeJS

Controls

• Grids• Date Pickers• Tree views• Input Masking• KendoUI and JQueryUI

Page 9: Testable Web Applications With  AngularJS  and  NodeJS

Module Loading

• Dependency management• Code separation• RequireJS

Page 10: Testable Web Applications With  AngularJS  and  NodeJS
Page 11: Testable Web Applications With  AngularJS  and  NodeJS

Unit Testing

• Specifications• Modules• MV* compatibility• Qunit, Jasmine

Page 12: Testable Web Applications With  AngularJS  and  NodeJS

Issues

• Many different libraries• Not cohesive• Difficult to test• Compatibility issues• Onboarding

Page 13: Testable Web Applications With  AngularJS  and  NodeJS

Demo: Testability

• Testing with this setup can be problematic

Page 14: Testable Web Applications With  AngularJS  and  NodeJS

Frameworks

• “Inversion of Control is a key part of what makes a framework different to a library. A library is essentially a set of functions that you can call, these days usually organized into classes. Each call does some work and returns control to the client.” – Martin Fowler

Page 15: Testable Web Applications With  AngularJS  and  NodeJS

Discuss: Framework or Not

Page 16: Testable Web Applications With  AngularJS  and  NodeJS

Requirements

• Inventory management app• Define a household inventory• Indicate when items are used• Generate a grocery list of needed items

Page 17: Testable Web Applications With  AngularJS  and  NodeJS

Angular JS

• MV* framework• Cohesive and “opinionated”• All the necessary functionality for SPA• Helps you write testable code (DI)• AngularUI Team works on UI controls

Page 18: Testable Web Applications With  AngularJS  and  NodeJS

Controllers

• Contains logic for rendering your View• Fields for data-binding• Avoid DOM manipulation• May be associated with a template• Example

Page 19: Testable Web Applications With  AngularJS  and  NodeJS

Directives

• New tags/attributes• “Custom bindings”• Nested templates• DOM manipulation• Example

Page 20: Testable Web Applications With  AngularJS  and  NodeJS

Services

• Share logic between controllers• Keeps controllers clean• Business logic• Example

Page 21: Testable Web Applications With  AngularJS  and  NodeJS

Resources

• Similar to service proxy• Interact with any RESTful API

Page 22: Testable Web Applications With  AngularJS  and  NodeJS

Overview

• Controllers• Directives• Services• Resources

Page 23: Testable Web Applications With  AngularJS  and  NodeJS

Full App Demo

Page 24: Testable Web Applications With  AngularJS  and  NodeJS

Testing

• Dependency injection• Jasmine• Karma Testrunner

Page 25: Testable Web Applications With  AngularJS  and  NodeJS

Dependency Injection

• Dependency injection is a software design pattern that allows the removal of hard-coded dependencies and makes it possible to change them, whether at run-time or compile-time.

Page 26: Testable Web Applications With  AngularJS  and  NodeJS

Full Testing Demo

Page 27: Testable Web Applications With  AngularJS  and  NodeJS

Pluralsight

• AngularJS Fundamentals• AngularJS for .NET Developers• AngularJS In-Depth• Application Building Patterns with AngularJS• Building a Site with Bootstrap, AngularJS…• Building AngularJS and Node.js Apps…• Building Apps with Angular and Breeze

Page 28: Testable Web Applications With  AngularJS  and  NodeJS

Other Resources

• http://docs.angularjs.org/api• http://docs.angularjs.org/tutorial/• https://github.com/angular/angular-seed