Testing Angular 2 Applications - Rich Web 2016

Matt Raible
Matt RaibleWeb Developer, Java Champion, and Developer Advocate at Okta
Testing 2 Applications
Photos by McGinity Photo

Matt Raible • @mraible
Blogger on raibledesigns.com
UI Architect and Java Champion
Father, Skier, Mountain
Biker, Whitewater Rafter
Web Framework Connoisseur
Who is Matt Raible?
Bus Lover
Stormpath Developer Evangelist
What about YOU?
How long have you been doing web development?

Do you like JavaScript? TypeScript?

What’s your favorite JavaScript framework?

Why are you here?
Quality
“A person who knows how to fix motorcycles—with Quality—is less
likely to run short of friends than one who doesn't. And they aren't
going to see him as some kind of object either. Quality destroys
objectivity every time.”

— Zen and the Art of Motorcycle Maintenance
Software Testing
With motorcycles, you drive to test them.

With software, you can test it without driving it.

Or rather, you can automate the driving.

If you don’t automate tests, you’re still testing!
Hello World with AngularJS
<!doctype html>
<html ng-app>
<head>
<title>Hello World</title>
</head>
<body>
<div>
<label>Name:</label>
<input type="text" ng-model="name" placeholder="Enter a name here">
<hr>
<h1>Hello {{name}}!</h1>
</div>
<script src="http://code.angularjs.org/1.5.8/angular.min.js"></script>
</body>
</html>
Testing Angular 2 Applications - Rich Web 2016
Hello World with Angular 2
<html>
<head>
<title>Angular 2 QuickStart</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
<!-- 1. Load libraries -->
<!-- Polyfills, for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/reflect-metadata/Reflect.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
</head>
</html>
Hello World with Angular 2
<!-- 2. Configure SystemJS -->
<script>
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js'
}
}
});
System.import('app/main')
.then(null, console.error.bind(console));
</script>
</head>
<!-- 3. Display the application -->
<body>
<my-app>Loading...</my-app>
</body>
</html>
app/main.ts
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppComponent } from './app.component';
platformBrowserDynamic().bootstrapModule(AppComponent);
app/app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: '<h1>My First Angular 2 App</h1>'
})
export class AppComponent { }
Angular 2 QuickStart
Easiest ways to get started
Angular 2 QuickStart

https://github.com/angular/quickstart 

Angular 2 (and beyond) Seed

https://github.com/mgechev/angular-seed 

Angular CLI

https://github.com/angular/angular-cli
Testing Angular 2 Applications - Rich Web 2016
Testing Angular 2 Applications - Rich Web 2016
Testing Angular 2 Applications - Rich Web 2016
Let’s take a look at a few things…
Angular CLI

TypeScript

Unit Tests

Integration Tests

Continuous Integration

Deployment
Testing Angular 2 Applications - Rich Web 2016
Angular CLI
npm install -g angular-cli
ng new ng2-demo
cd ng2-demo
ng serve
ng test
ng e2e
ng g component
ng g service
ng build
ng --help
ES6, ES7 and TypeScript
TSES7ES6ES5
ES5: es5.github.io 

ES6: git.io/es6features 

ES7: DRAFT

TS: www.typescriptlang.org
JavaScript Versioning
TypeScript
$ npm install -g typescript

function greeter(person: string) {

return "Hello, " + person;

}



var user = "Jane User";



document.body.innerHTML = greeter(user);
$ tsc greeter.ts

https://www.typescriptlang.org/docs/tutorial.html
bus.ts
Types of Tests
Unit Tests

End-to-End Tests
Unit Test Example
bus.spec.ts
Demo Time!
What you learned
How to…

Unit test Angular 2 services, mocking Http provider

Unit test Angular 2 components, mocking service

Integration test Angular 2 application

Continuously test and deploy with a CI server
Learn more about Angular CLI
https://www.youtube.com/watch?v=obbdFFbjLIU
Style Guides
Angular 2 Official Style Guide

https://angular.io/styleguide 

John Papa’s AngularJS Style Guide

https://github.com/johnpapa/angular-styleguide
ng-book 2
A comprehensive guide to developing with
Angular 2

Sample apps: Reddit clone, Chat with RxJS
Observables, YouTube search-as-you-type,
Spotify Search

How to write components, use forms and APIs

Over 5,500+ lines of code!
Testing Angular 2 Applications Book
Unit testing directives, pipes, services, and routes

End-to-end testing with elements and forms

4 of 10 chapters available

Estimated publication: Spring 2017
Testing JavaScript Applications
Don’t be afraid of testing!
Don’t be afraid of testing!
Don’t be afraid of testing!
Stormpath SDK for Angular 2
Lessons Learned at Stormpath
generator-angular-library is a great tool

npm install -g yo generator-angular-library
yo angular-library
Override templates in components with ngOutletTemplate

Write lots of tests and demos that use your library
Testing Angular 2 Applications - Rich Web 2016
Resources
Demo Code

https://github.com/mraible/ng2-demo 

Step-by-step Tutorial

http://gist.asciidoctor.org/?github-mraible/ng2-demo//README.adoc
Contact Me!

raibledesigns.com

@mraible

linkedin.com/in/mraible

Presentations

slideshare.net/mraible

Code

github.com/mraible
Questions?
When will Angular 3 be released?
1 of 42

Recommended

Cloud Native Progressive Web Applications - Denver JUG 2016 by
Cloud Native Progressive Web Applications - Denver JUG 2016Cloud Native Progressive Web Applications - Denver JUG 2016
Cloud Native Progressive Web Applications - Denver JUG 2016Matt Raible
1K views36 slides
Testing Angular Applications - Jfokus 2017 by
Testing Angular Applications - Jfokus 2017Testing Angular Applications - Jfokus 2017
Testing Angular Applications - Jfokus 2017Matt Raible
1.6K views35 slides
Building a PWA with Ionic, Angular and Spring Boot - Jfokus 2017 by
Building a PWA with Ionic, Angular and Spring Boot - Jfokus 2017Building a PWA with Ionic, Angular and Spring Boot - Jfokus 2017
Building a PWA with Ionic, Angular and Spring Boot - Jfokus 2017Matt Raible
2.7K views22 slides
What's New in JHipsterLand - DevNexus 2017 by
What's New in JHipsterLand - DevNexus 2017What's New in JHipsterLand - DevNexus 2017
What's New in JHipsterLand - DevNexus 2017Matt Raible
660 views41 slides
Getting Started with Angular - Stormpath Webinar, January 2017 by
Getting Started with Angular - Stormpath Webinar, January 2017Getting Started with Angular - Stormpath Webinar, January 2017
Getting Started with Angular - Stormpath Webinar, January 2017Matt Raible
718 views42 slides
Testing Angular 2 Applications - HTML5 Denver 2016 by
Testing Angular 2 Applications - HTML5 Denver 2016Testing Angular 2 Applications - HTML5 Denver 2016
Testing Angular 2 Applications - HTML5 Denver 2016Matt Raible
1.3K views27 slides

More Related Content

What's hot

Building Cloud Native Progressive Web Apps with Angular and Spring Boot - Dev... by
Building Cloud Native Progressive Web Apps with Angular and Spring Boot - Dev...Building Cloud Native Progressive Web Apps with Angular and Spring Boot - Dev...
Building Cloud Native Progressive Web Apps with Angular and Spring Boot - Dev...Matt Raible
440 views48 slides
Developing PWAs and Mobile Apps with Ionic, Angular, and JHipster - Devoxx Mo... by
Developing PWAs and Mobile Apps with Ionic, Angular, and JHipster - Devoxx Mo...Developing PWAs and Mobile Apps with Ionic, Angular, and JHipster - Devoxx Mo...
Developing PWAs and Mobile Apps with Ionic, Angular, and JHipster - Devoxx Mo...Matt Raible
1.2K views39 slides
The Art of Angular in 2016 - Devoxx France 2016 by
The Art of Angular in 2016 - Devoxx France 2016The Art of Angular in 2016 - Devoxx France 2016
The Art of Angular in 2016 - Devoxx France 2016Matt Raible
5.9K views50 slides
The Ultimate Getting Started with Angular Workshop - Devoxx France 2017 by
The Ultimate Getting Started with Angular Workshop - Devoxx France 2017The Ultimate Getting Started with Angular Workshop - Devoxx France 2017
The Ultimate Getting Started with Angular Workshop - Devoxx France 2017Matt Raible
211 views62 slides
On Selecting JavaScript Frameworks (Women Who Code 10/15) by
On Selecting JavaScript Frameworks (Women Who Code 10/15)On Selecting JavaScript Frameworks (Women Who Code 10/15)
On Selecting JavaScript Frameworks (Women Who Code 10/15)Zoe Landon
900 views53 slides
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015 by
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015Matt Raible
6.7K views39 slides

What's hot(20)

Building Cloud Native Progressive Web Apps with Angular and Spring Boot - Dev... by Matt Raible
Building Cloud Native Progressive Web Apps with Angular and Spring Boot - Dev...Building Cloud Native Progressive Web Apps with Angular and Spring Boot - Dev...
Building Cloud Native Progressive Web Apps with Angular and Spring Boot - Dev...
Matt Raible440 views
Developing PWAs and Mobile Apps with Ionic, Angular, and JHipster - Devoxx Mo... by Matt Raible
Developing PWAs and Mobile Apps with Ionic, Angular, and JHipster - Devoxx Mo...Developing PWAs and Mobile Apps with Ionic, Angular, and JHipster - Devoxx Mo...
Developing PWAs and Mobile Apps with Ionic, Angular, and JHipster - Devoxx Mo...
Matt Raible1.2K views
The Art of Angular in 2016 - Devoxx France 2016 by Matt Raible
The Art of Angular in 2016 - Devoxx France 2016The Art of Angular in 2016 - Devoxx France 2016
The Art of Angular in 2016 - Devoxx France 2016
Matt Raible5.9K views
The Ultimate Getting Started with Angular Workshop - Devoxx France 2017 by Matt Raible
The Ultimate Getting Started with Angular Workshop - Devoxx France 2017The Ultimate Getting Started with Angular Workshop - Devoxx France 2017
The Ultimate Getting Started with Angular Workshop - Devoxx France 2017
Matt Raible211 views
On Selecting JavaScript Frameworks (Women Who Code 10/15) by Zoe Landon
On Selecting JavaScript Frameworks (Women Who Code 10/15)On Selecting JavaScript Frameworks (Women Who Code 10/15)
On Selecting JavaScript Frameworks (Women Who Code 10/15)
Zoe Landon900 views
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015 by Matt Raible
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015
Matt Raible6.7K views
What's New in JHipsterLand - Devoxx US 2017 by Matt Raible
What's New in JHipsterLand - Devoxx US 2017What's New in JHipsterLand - Devoxx US 2017
What's New in JHipsterLand - Devoxx US 2017
Matt Raible201 views
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Rich Web Experie... by Matt Raible
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Rich Web Experie...Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Rich Web Experie...
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Rich Web Experie...
Matt Raible3.4K views
Microservices for the Masses with Spring Boot, JHipster, and JWT - Rich Web 2016 by Matt Raible
Microservices for the Masses with Spring Boot, JHipster, and JWT - Rich Web 2016Microservices for the Masses with Spring Boot, JHipster, and JWT - Rich Web 2016
Microservices for the Masses with Spring Boot, JHipster, and JWT - Rich Web 2016
Matt Raible4.2K views
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016 by Matt Raible
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016
Matt Raible109.9K views
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Angular Summit 2015 by Matt Raible
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Angular Summit 2015Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Angular Summit 2015
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Angular Summit 2015
Matt Raible38.7K views
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016 by Matt Raible
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016
Matt Raible5.5K views
Get Hip with JHipster - Denver JUG 2015 by Matt Raible
Get Hip with JHipster - Denver JUG 2015Get Hip with JHipster - Denver JUG 2015
Get Hip with JHipster - Denver JUG 2015
Matt Raible26.6K views
Choosing the best JavaScript framework/library/toolkit by Hristo Chakarov
Choosing the best JavaScript framework/library/toolkitChoosing the best JavaScript framework/library/toolkit
Choosing the best JavaScript framework/library/toolkit
Hristo Chakarov2.5K views
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016 by Matt Raible
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016
Matt Raible3.7K views
Building a PWA with Ionic, Angular, and Spring Boot - GeeCON 2017 by Matt Raible
Building a PWA with Ionic, Angular, and Spring Boot - GeeCON 2017Building a PWA with Ionic, Angular, and Spring Boot - GeeCON 2017
Building a PWA with Ionic, Angular, and Spring Boot - GeeCON 2017
Matt Raible771 views
Testing Mobile JavaScript by jeresig
Testing Mobile JavaScriptTesting Mobile JavaScript
Testing Mobile JavaScript
jeresig215.2K views
Get Hip with JHipster - Colorado Springs OSS Meetup April 2016 by Matt Raible
Get Hip with JHipster - Colorado Springs OSS Meetup April 2016Get Hip with JHipster - Colorado Springs OSS Meetup April 2016
Get Hip with JHipster - Colorado Springs OSS Meetup April 2016
Matt Raible2K views
Test your Javascript! v1.1 by Eric Wendelin
Test your Javascript! v1.1Test your Javascript! v1.1
Test your Javascript! v1.1
Eric Wendelin10.7K views
Avoiding Common Pitfalls in Ember.js by Alex Speller
Avoiding Common Pitfalls in Ember.jsAvoiding Common Pitfalls in Ember.js
Avoiding Common Pitfalls in Ember.js
Alex Speller22.9K views

Viewers also liked

Deploying JHipster Microservices by
Deploying JHipster MicroservicesDeploying JHipster Microservices
Deploying JHipster MicroservicesJoe Kutner
3.9K views170 slides
Serverless Microservices - Real life story of a Web App that uses AngularJS, ... by
Serverless Microservices - Real life story of a Web App that uses AngularJS, ...Serverless Microservices - Real life story of a Web App that uses AngularJS, ...
Serverless Microservices - Real life story of a Web App that uses AngularJS, ...Mitoc Group
6.7K views42 slides
Angular testing by
Angular testingAngular testing
Angular testingYu Jin
1.5K views11 slides
Deploy, Scale and Sleep at Night with JRuby by
Deploy, Scale and Sleep at Night with JRubyDeploy, Scale and Sleep at Night with JRuby
Deploy, Scale and Sleep at Night with JRubyJoe Kutner
4.2K views39 slides
Java & JWT Stateless authentication by
Java & JWT Stateless authenticationJava & JWT Stateless authentication
Java & JWT Stateless authenticationKarlo Novak
600 views21 slides
Test-Driven Development with TypeScript+Jasmine+AngularJS by
Test-Driven Development with TypeScript+Jasmine+AngularJSTest-Driven Development with TypeScript+Jasmine+AngularJS
Test-Driven Development with TypeScript+Jasmine+AngularJSSmartOrg
6.2K views29 slides

Viewers also liked(15)

Deploying JHipster Microservices by Joe Kutner
Deploying JHipster MicroservicesDeploying JHipster Microservices
Deploying JHipster Microservices
Joe Kutner3.9K views
Serverless Microservices - Real life story of a Web App that uses AngularJS, ... by Mitoc Group
Serverless Microservices - Real life story of a Web App that uses AngularJS, ...Serverless Microservices - Real life story of a Web App that uses AngularJS, ...
Serverless Microservices - Real life story of a Web App that uses AngularJS, ...
Mitoc Group6.7K views
Angular testing by Yu Jin
Angular testingAngular testing
Angular testing
Yu Jin1.5K views
Deploy, Scale and Sleep at Night with JRuby by Joe Kutner
Deploy, Scale and Sleep at Night with JRubyDeploy, Scale and Sleep at Night with JRuby
Deploy, Scale and Sleep at Night with JRuby
Joe Kutner4.2K views
Java & JWT Stateless authentication by Karlo Novak
Java & JWT Stateless authenticationJava & JWT Stateless authentication
Java & JWT Stateless authentication
Karlo Novak600 views
Test-Driven Development with TypeScript+Jasmine+AngularJS by SmartOrg
Test-Driven Development with TypeScript+Jasmine+AngularJSTest-Driven Development with TypeScript+Jasmine+AngularJS
Test-Driven Development with TypeScript+Jasmine+AngularJS
SmartOrg 6.2K views
AngularJS for Beginners by Edureka!
AngularJS for BeginnersAngularJS for Beginners
AngularJS for Beginners
Edureka!8.4K views
Mockito vs JMockit, battle of the mocking frameworks by EndranNL
Mockito vs JMockit, battle of the mocking frameworksMockito vs JMockit, battle of the mocking frameworks
Mockito vs JMockit, battle of the mocking frameworks
EndranNL1.7K views
The Art of AngularJS in 2015 - Angular Summit 2015 by Matt Raible
The Art of AngularJS in 2015 - Angular Summit 2015The Art of AngularJS in 2015 - Angular Summit 2015
The Art of AngularJS in 2015 - Angular Summit 2015
Matt Raible37.3K views
JHipster, modern web application development made easy by Raphaël Brugier
JHipster, modern web application development made easyJHipster, modern web application development made easy
JHipster, modern web application development made easy
Raphaël Brugier1.3K views
Angular2 with type script by Ravi Mone
Angular2 with type scriptAngular2 with type script
Angular2 with type script
Ravi Mone1.2K views
Migrating your monolithic application for micro services with JHipster by Lazaro Prates Junior
Migrating your monolithic application for micro services with JHipsterMigrating your monolithic application for micro services with JHipster
Migrating your monolithic application for micro services with JHipster
How we built a job board in one week with JHipster by Kile Niklawski
How we built a job board in one week with JHipsterHow we built a job board in one week with JHipster
How we built a job board in one week with JHipster
Kile Niklawski10.5K views

Similar to Testing Angular 2 Applications - Rich Web 2016

TDD super mondays-june-2014 by
TDD super mondays-june-2014TDD super mondays-june-2014
TDD super mondays-june-2014Alex Kavanagh
760 views39 slides
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin... by
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...Matt Raible
68.4K views170 slides
Browser Automated Testing Frameworks - Nightwatch.js by
Browser Automated Testing Frameworks - Nightwatch.jsBrowser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsLuís Bastião Silva
7K views20 slides
Getting Started with the Angular 2 CLI by
Getting Started with the Angular 2 CLIGetting Started with the Angular 2 CLI
Getting Started with the Angular 2 CLIJim Lynch
1.7K views57 slides
Use React tools for better Angular apps by
Use React tools for better Angular appsUse React tools for better Angular apps
Use React tools for better Angular appsMartin Hochel
650 views58 slides
How I learned to stop worrying and love embedding JavaScript by
How I learned to stop worrying and love embedding JavaScriptHow I learned to stop worrying and love embedding JavaScript
How I learned to stop worrying and love embedding JavaScriptKevin Read
1.4K views33 slides

Similar to Testing Angular 2 Applications - Rich Web 2016(20)

TDD super mondays-june-2014 by Alex Kavanagh
TDD super mondays-june-2014TDD super mondays-june-2014
TDD super mondays-june-2014
Alex Kavanagh760 views
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin... by Matt Raible
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Matt Raible68.4K views
Getting Started with the Angular 2 CLI by Jim Lynch
Getting Started with the Angular 2 CLIGetting Started with the Angular 2 CLI
Getting Started with the Angular 2 CLI
Jim Lynch1.7K views
Use React tools for better Angular apps by Martin Hochel
Use React tools for better Angular appsUse React tools for better Angular apps
Use React tools for better Angular apps
Martin Hochel650 views
How I learned to stop worrying and love embedding JavaScript by Kevin Read
How I learned to stop worrying and love embedding JavaScriptHow I learned to stop worrying and love embedding JavaScript
How I learned to stop worrying and love embedding JavaScript
Kevin Read1.4K views
Embedding V8 in Android apps with Ejecta-V8 by Kevin Read
Embedding V8 in Android apps with Ejecta-V8Embedding V8 in Android apps with Ejecta-V8
Embedding V8 in Android apps with Ejecta-V8
Kevin Read258 views
Node.js meetup 17.05.2017 ember.js - escape the javascript fatigue by Tobias Braner
Node.js meetup 17.05.2017   ember.js - escape the javascript fatigueNode.js meetup 17.05.2017   ember.js - escape the javascript fatigue
Node.js meetup 17.05.2017 ember.js - escape the javascript fatigue
Tobias Braner195 views
Serverless in Production, an experience report (AWS UG South Wales) by Yan Cui
Serverless in Production, an experience report (AWS UG South Wales)Serverless in Production, an experience report (AWS UG South Wales)
Serverless in Production, an experience report (AWS UG South Wales)
Yan Cui830 views
Getting Started With AngularJS by Omnia Helmi
Getting Started With AngularJSGetting Started With AngularJS
Getting Started With AngularJS
Omnia Helmi1.5K views
Colorful world-of-visual-automation-testing-latest by Onur Baskirt
Colorful world-of-visual-automation-testing-latestColorful world-of-visual-automation-testing-latest
Colorful world-of-visual-automation-testing-latest
Onur Baskirt2.1K views
Serverless in production, an experience report (FullStack 2018) by Yan Cui
Serverless in production, an experience report (FullStack 2018)Serverless in production, an experience report (FullStack 2018)
Serverless in production, an experience report (FullStack 2018)
Yan Cui359 views
Serverless in production, an experience report by Yan Cui
Serverless in production, an experience reportServerless in production, an experience report
Serverless in production, an experience report
Yan Cui1.3K views
Front End Development for Back End Developers - vJUG24 2017 by Matt Raible
Front End Development for Back End Developers - vJUG24 2017Front End Development for Back End Developers - vJUG24 2017
Front End Development for Back End Developers - vJUG24 2017
Matt Raible731 views
Angular JS, A dive to concepts by Abhishek Sur
Angular JS, A dive to conceptsAngular JS, A dive to concepts
Angular JS, A dive to concepts
Abhishek Sur523 views
Intro To Django by Udi Bauman
Intro To DjangoIntro To Django
Intro To Django
Udi Bauman2.6K views
Quick introduction to Angular 4 for AngularJS 1.5 developers by Paweł Żurowski
Quick introduction to Angular 4 for AngularJS 1.5 developersQuick introduction to Angular 4 for AngularJS 1.5 developers
Quick introduction to Angular 4 for AngularJS 1.5 developers
Paweł Żurowski2.5K views
Appium workshop technopark trivandrum by Syam Sasi
Appium workshop technopark trivandrumAppium workshop technopark trivandrum
Appium workshop technopark trivandrum
Syam Sasi1.4K views

More from Matt Raible

Micro Frontends for Java Microservices - Belfast JUG 2022 by
Micro Frontends for Java Microservices - Belfast JUG 2022Micro Frontends for Java Microservices - Belfast JUG 2022
Micro Frontends for Java Microservices - Belfast JUG 2022Matt Raible
26 views57 slides
Micro Frontends for Java Microservices - Dublin JUG 2022 by
Micro Frontends for Java Microservices - Dublin JUG 2022Micro Frontends for Java Microservices - Dublin JUG 2022
Micro Frontends for Java Microservices - Dublin JUG 2022Matt Raible
19 views56 slides
Micro Frontends for Java Microservices - Cork JUG 2022 by
Micro Frontends for Java Microservices - Cork JUG 2022Micro Frontends for Java Microservices - Cork JUG 2022
Micro Frontends for Java Microservices - Cork JUG 2022Matt Raible
7 views56 slides
Comparing Native Java REST API Frameworks - Seattle JUG 2022 by
Comparing Native Java REST API Frameworks - Seattle JUG 2022Comparing Native Java REST API Frameworks - Seattle JUG 2022
Comparing Native Java REST API Frameworks - Seattle JUG 2022Matt Raible
48 views87 slides
Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022 by
Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022
Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022Matt Raible
105 views42 slides
Comparing Native Java REST API Frameworks - Devoxx France 2022 by
Comparing Native Java REST API Frameworks - Devoxx France 2022Comparing Native Java REST API Frameworks - Devoxx France 2022
Comparing Native Java REST API Frameworks - Devoxx France 2022Matt Raible
130 views86 slides

More from Matt Raible(20)

Micro Frontends for Java Microservices - Belfast JUG 2022 by Matt Raible
Micro Frontends for Java Microservices - Belfast JUG 2022Micro Frontends for Java Microservices - Belfast JUG 2022
Micro Frontends for Java Microservices - Belfast JUG 2022
Matt Raible26 views
Micro Frontends for Java Microservices - Dublin JUG 2022 by Matt Raible
Micro Frontends for Java Microservices - Dublin JUG 2022Micro Frontends for Java Microservices - Dublin JUG 2022
Micro Frontends for Java Microservices - Dublin JUG 2022
Matt Raible19 views
Micro Frontends for Java Microservices - Cork JUG 2022 by Matt Raible
Micro Frontends for Java Microservices - Cork JUG 2022Micro Frontends for Java Microservices - Cork JUG 2022
Micro Frontends for Java Microservices - Cork JUG 2022
Matt Raible7 views
Comparing Native Java REST API Frameworks - Seattle JUG 2022 by Matt Raible
Comparing Native Java REST API Frameworks - Seattle JUG 2022Comparing Native Java REST API Frameworks - Seattle JUG 2022
Comparing Native Java REST API Frameworks - Seattle JUG 2022
Matt Raible48 views
Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022 by Matt Raible
Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022
Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022
Matt Raible105 views
Comparing Native Java REST API Frameworks - Devoxx France 2022 by Matt Raible
Comparing Native Java REST API Frameworks - Devoxx France 2022Comparing Native Java REST API Frameworks - Devoxx France 2022
Comparing Native Java REST API Frameworks - Devoxx France 2022
Matt Raible130 views
Lock That Sh*t Down! Auth Security Patterns for Apps, APIs, and Infra - Devne... by Matt Raible
Lock That Sh*t Down! Auth Security Patterns for Apps, APIs, and Infra - Devne...Lock That Sh*t Down! Auth Security Patterns for Apps, APIs, and Infra - Devne...
Lock That Sh*t Down! Auth Security Patterns for Apps, APIs, and Infra - Devne...
Matt Raible98 views
Java REST API Framework Comparison - PWX 2021 by Matt Raible
Java REST API Framework Comparison - PWX 2021Java REST API Framework Comparison - PWX 2021
Java REST API Framework Comparison - PWX 2021
Matt Raible148 views
Web App Security for Java Developers - PWX 2021 by Matt Raible
Web App Security for Java Developers - PWX 2021Web App Security for Java Developers - PWX 2021
Web App Security for Java Developers - PWX 2021
Matt Raible135 views
Mobile App Development with Ionic, React Native, and JHipster - Connect.Tech ... by Matt Raible
Mobile App Development with Ionic, React Native, and JHipster - Connect.Tech ...Mobile App Development with Ionic, React Native, and JHipster - Connect.Tech ...
Mobile App Development with Ionic, React Native, and JHipster - Connect.Tech ...
Matt Raible187 views
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Joker... by Matt Raible
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Joker...Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Joker...
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Joker...
Matt Raible140 views
Web App Security for Java Developers - UberConf 2021 by Matt Raible
Web App Security for Java Developers - UberConf 2021Web App Security for Java Developers - UberConf 2021
Web App Security for Java Developers - UberConf 2021
Matt Raible152 views
Java REST API Framework Comparison - UberConf 2021 by Matt Raible
Java REST API Framework Comparison - UberConf 2021Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021
Matt Raible150 views
Native Java with Spring Boot and JHipster - SF JUG 2021 by Matt Raible
Native Java with Spring Boot and JHipster - SF JUG 2021Native Java with Spring Boot and JHipster - SF JUG 2021
Native Java with Spring Boot and JHipster - SF JUG 2021
Matt Raible69 views
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin... by Matt Raible
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...
Matt Raible182 views
Reactive Java Microservices with Spring Boot and JHipster - Denver JUG 2021 by Matt Raible
Reactive Java Microservices with Spring Boot and JHipster - Denver JUG 2021Reactive Java Microservices with Spring Boot and JHipster - Denver JUG 2021
Reactive Java Microservices with Spring Boot and JHipster - Denver JUG 2021
Matt Raible182 views
Get Hip with JHipster - Colorado Springs Open Source User Group 2021 by Matt Raible
Get Hip with JHipster - Colorado Springs Open Source User Group 2021Get Hip with JHipster - Colorado Springs Open Source User Group 2021
Get Hip with JHipster - Colorado Springs Open Source User Group 2021
Matt Raible150 views
JHipster and Okta - JHipster Virtual Meetup December 2020 by Matt Raible
JHipster and Okta - JHipster Virtual Meetup December 2020JHipster and Okta - JHipster Virtual Meetup December 2020
JHipster and Okta - JHipster Virtual Meetup December 2020
Matt Raible226 views
Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020 by Matt Raible
Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020
Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020
Matt Raible433 views
Security Patterns for Microservice Architectures - SpringOne 2020 by Matt Raible
Security Patterns for Microservice Architectures - SpringOne 2020Security Patterns for Microservice Architectures - SpringOne 2020
Security Patterns for Microservice Architectures - SpringOne 2020
Matt Raible329 views

Recently uploaded

TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... by
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc
11 views29 slides
Serverless computing with Google Cloud (2023-24) by
Serverless computing with Google Cloud (2023-24)Serverless computing with Google Cloud (2023-24)
Serverless computing with Google Cloud (2023-24)wesley chun
11 views33 slides
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ... by
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...Jasper Oosterveld
19 views49 slides
Zero to Automated in Under a Year by
Zero to Automated in Under a YearZero to Automated in Under a Year
Zero to Automated in Under a YearNetwork Automation Forum
15 views23 slides
Info Session November 2023.pdf by
Info Session November 2023.pdfInfo Session November 2023.pdf
Info Session November 2023.pdfAleksandraKoprivica4
13 views15 slides
Business Analyst Series 2023 - Week 3 Session 5 by
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5DianaGray10
300 views20 slides

Recently uploaded(20)

TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... by TrustArc
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc11 views
Serverless computing with Google Cloud (2023-24) by wesley chun
Serverless computing with Google Cloud (2023-24)Serverless computing with Google Cloud (2023-24)
Serverless computing with Google Cloud (2023-24)
wesley chun11 views
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ... by Jasper Oosterveld
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...
Business Analyst Series 2023 - Week 3 Session 5 by DianaGray10
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5
DianaGray10300 views
"Running students' code in isolation. The hard way", Yurii Holiuk by Fwdays
"Running students' code in isolation. The hard way", Yurii Holiuk "Running students' code in isolation. The hard way", Yurii Holiuk
"Running students' code in isolation. The hard way", Yurii Holiuk
Fwdays17 views
HTTP headers that make your website go faster - devs.gent November 2023 by Thijs Feryn
HTTP headers that make your website go faster - devs.gent November 2023HTTP headers that make your website go faster - devs.gent November 2023
HTTP headers that make your website go faster - devs.gent November 2023
Thijs Feryn22 views
Data Integrity for Banking and Financial Services by Precisely
Data Integrity for Banking and Financial ServicesData Integrity for Banking and Financial Services
Data Integrity for Banking and Financial Services
Precisely25 views
Unit 1_Lecture 2_Physical Design of IoT.pdf by StephenTec
Unit 1_Lecture 2_Physical Design of IoT.pdfUnit 1_Lecture 2_Physical Design of IoT.pdf
Unit 1_Lecture 2_Physical Design of IoT.pdf
StephenTec12 views
Future of AR - Facebook Presentation by ssuserb54b561
Future of AR - Facebook PresentationFuture of AR - Facebook Presentation
Future of AR - Facebook Presentation
ssuserb54b56115 views

Testing Angular 2 Applications - Rich Web 2016

  • 1. Testing 2 Applications Photos by McGinity Photo Matt Raible • @mraible
  • 2. Blogger on raibledesigns.com UI Architect and Java Champion Father, Skier, Mountain Biker, Whitewater Rafter Web Framework Connoisseur Who is Matt Raible? Bus Lover Stormpath Developer Evangelist
  • 3. What about YOU? How long have you been doing web development? Do you like JavaScript? TypeScript? What’s your favorite JavaScript framework? Why are you here?
  • 4. Quality “A person who knows how to fix motorcycles—with Quality—is less likely to run short of friends than one who doesn't. And they aren't going to see him as some kind of object either. Quality destroys objectivity every time.” — Zen and the Art of Motorcycle Maintenance
  • 5. Software Testing With motorcycles, you drive to test them. With software, you can test it without driving it. Or rather, you can automate the driving. If you don’t automate tests, you’re still testing!
  • 6. Hello World with AngularJS <!doctype html> <html ng-app> <head> <title>Hello World</title> </head> <body> <div> <label>Name:</label> <input type="text" ng-model="name" placeholder="Enter a name here"> <hr> <h1>Hello {{name}}!</h1> </div> <script src="http://code.angularjs.org/1.5.8/angular.min.js"></script> </body> </html>
  • 8. Hello World with Angular 2 <html> <head> <title>Angular 2 QuickStart</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="styles.css"> <!-- 1. Load libraries --> <!-- Polyfills, for older browsers --> <script src="node_modules/core-js/client/shim.min.js"></script> <script src="node_modules/zone.js/dist/zone.js"></script> <script src="node_modules/reflect-metadata/Reflect.js"></script> <script src="node_modules/systemjs/dist/system.src.js"></script> </head> </html>
  • 9. Hello World with Angular 2 <!-- 2. Configure SystemJS --> <script> System.config({ packages: { app: { format: 'register', defaultExtension: 'js' } } }); System.import('app/main') .then(null, console.error.bind(console)); </script> </head> <!-- 3. Display the application --> <body> <my-app>Loading...</my-app> </body> </html>
  • 10. app/main.ts import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { AppComponent } from './app.component'; platformBrowserDynamic().bootstrapModule(AppComponent);
  • 11. app/app.component.ts import { Component } from '@angular/core'; @Component({ selector: 'my-app', template: '<h1>My First Angular 2 App</h1>' }) export class AppComponent { }
  • 13. Easiest ways to get started Angular 2 QuickStart https://github.com/angular/quickstart Angular 2 (and beyond) Seed https://github.com/mgechev/angular-seed Angular CLI https://github.com/angular/angular-cli
  • 17. Let’s take a look at a few things… Angular CLI TypeScript Unit Tests Integration Tests Continuous Integration Deployment
  • 19. Angular CLI npm install -g angular-cli ng new ng2-demo cd ng2-demo ng serve ng test ng e2e ng g component ng g service ng build ng --help
  • 20. ES6, ES7 and TypeScript TSES7ES6ES5 ES5: es5.github.io ES6: git.io/es6features ES7: DRAFT TS: www.typescriptlang.org
  • 22. TypeScript $ npm install -g typescript function greeter(person: string) {
 return "Hello, " + person;
 }
 
 var user = "Jane User";
 
 document.body.innerHTML = greeter(user); $ tsc greeter.ts https://www.typescriptlang.org/docs/tutorial.html
  • 24. Types of Tests Unit Tests End-to-End Tests
  • 28. What you learned How to… Unit test Angular 2 services, mocking Http provider Unit test Angular 2 components, mocking service Integration test Angular 2 application Continuously test and deploy with a CI server
  • 29. Learn more about Angular CLI https://www.youtube.com/watch?v=obbdFFbjLIU
  • 30. Style Guides Angular 2 Official Style Guide https://angular.io/styleguide John Papa’s AngularJS Style Guide https://github.com/johnpapa/angular-styleguide
  • 31. ng-book 2 A comprehensive guide to developing with Angular 2 Sample apps: Reddit clone, Chat with RxJS Observables, YouTube search-as-you-type, Spotify Search How to write components, use forms and APIs Over 5,500+ lines of code!
  • 32. Testing Angular 2 Applications Book Unit testing directives, pipes, services, and routes End-to-end testing with elements and forms 4 of 10 chapters available Estimated publication: Spring 2017
  • 34. Don’t be afraid of testing!
  • 35. Don’t be afraid of testing!
  • 36. Don’t be afraid of testing!
  • 37. Stormpath SDK for Angular 2
  • 38. Lessons Learned at Stormpath generator-angular-library is a great tool npm install -g yo generator-angular-library yo angular-library Override templates in components with ngOutletTemplate Write lots of tests and demos that use your library
  • 40. Resources Demo Code https://github.com/mraible/ng2-demo Step-by-step Tutorial http://gist.asciidoctor.org/?github-mraible/ng2-demo//README.adoc
  • 42. When will Angular 3 be released?