front end from the front lines: building testing and deploying modern web apps

70
Front End from the Front Lines Building, Testing and Deploying Modern Web Apps Nick Van Exan @nvanexan

Upload: nicholas-van-exan

Post on 16-Apr-2017

226 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Front End from the Front LinesBuilding, Testing and Deploying Modern Web Apps

Nick Van Exan @nvanexan

Page 2: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Outline• The Velocity Economy (VE) + Moneyball for UX

• The Modern Front End Workflow:

• Design: Rapid Prototyping with Sketch + InVision

• Build: Automated Front-End Builds and Tooling

• Test: Automated E2E tests

• Deploy: Continuous integration + deployment to the cloud with VSTS and Azure

• Q&A / AMA

Page 3: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

The Velocity Economy

Page 4: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

The Velocity Economy

• Small teams

• Fixed sums of capital

• Testable hypotheses

• Rapid iteration

• Strong focus on design (esp. UX design)

Page 5: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Success in the Velocity Economy is intimately tied to the quality of UX.

Page 7: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Hypothesis: “Companies that focus on delivering great user experiences will see it

reflected in their stock price.”

Page 8: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

• Apple • Google • JetBlue • Netflix • Nike • Progressive Insurance • Target • Yahoo! • RIM (Blackberry) • Electronic Arts

UX Fund Companies

Page 9: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

UX Fund vs. Indices (1 Year Results)

UX Fund: 39.3% The Nasdaq: 29.1% Nasdaq 100: 28.7%

NYSE: 15.0% S&P 500: 10.3%

Page 10: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

UX Fund vs. Indices (1 Year Results)

Page 11: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Year 1: Gain $19,533.48 Year 10: Gain $250,044.52 (unrealized)

Year 1: 6 of 10 stocks gained Year 10: 9 of 10 stocks gained

Year 1: NASDAQ 29.1%, UX Fund 39.3% Year 10: NASDAQ 93.2%, UX Fund 450.1%

Page 12: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

UX Fund vs. NASDAQ (1 Year and 10 Year Growth)

Page 13: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

If a solid UX is the foundation of success in the Velocity Economy, how can we

guarantee more successful outcomes?

Page 14: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Moneyball for Digital ProductsWhat’s our key metric?

What’s the on-base-percentage for UX?

Page 15: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Time to User Feedback

Page 16: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

UX involves a lot of assumptions. Great designers and teams will get many right.

But there’s always things you did not / could not foresee.

Page 17: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

– http://firstround.com/review/From-0-to-1B-Slacks-Founder-Shares-Their-Epic-Launch-Strategy/

From 0 to $1B - Slack's Founder Shares Their Epic Launch Strategy

Page 18: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

–Stewart Butterfield

“We begged and cajoled our friends at other companies to try it out and give us feedback,” Butterfield recalls. There was Cozy, which sells rental management software for landlords and tenants, and the music service Rdio. “We had maybe six to ten companies to start with that

we found this way.”

Page 19: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

–Stewart Butterfield

“Suddenly we saw what the product looked like from the perspective of a much larger

team, and it was pretty gnarly.”

Page 20: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

–Stewart Butterfield

“We started inviting teams in batches and watched what happened. Then we made some changes, watched what happened,

made some more changes...”

Page 21: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Bottom Line: Ship early. Ship often.

Page 22: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

How to ship early, shift often?

• Rapidly prototype design solutions with Sketch and Invision

• Automate tedious build processes with tooling and task runners

• Automate E2E tests with tools like Protractor

• Use VSTS + Azure to set up a CI / CD pipeline

Page 23: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

1. DesignRapid Prototyping with Sketch and Invision

Page 24: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Sketch

• Lightweight vector graphics tool specifically designed for creating digital products

• Rendering is close to web

• Built in grids

• Multiple artboards / plugins make workflow super nice

Page 25: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Invision

• Web application for creating and sharing simple prototypes glued together with hotspots

• Super useful for gaining multi-stakeholder commentary on mock-ups

• Great features like hotspot templates, liveshare, inspect mode (beta), real video user testing

• Plays real nice with Sketch and can pair a prototype with any JIRA issue

Page 26: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Demo

Page 27: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

2. BuildAutomating UX Dev with Tooling and Task Runners

Page 28: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Building front-end web applications is no longer a

simple affair

Page 29: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Lots of front-end dependencies / libraries to

manage

Page 30: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Some code like SCSS has to be compiled before you can

preview results

Page 31: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

May be writing JS in ES6/ES7 or writing TypeScript, in which case you need to transpile your code

Page 32: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

All of your code needs to be minified / uglified for production

Page 33: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Code needs to be cached so that browser downloads only

updated modules

Page 34: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Code needs to be split and chunked so that only the minimal code necessary to render a view

is sent down the wire

Page 35: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

May have dead code in your app not being used, don’t want to

ship into prod

Page 36: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

May have several release environments, each with different

configuration settings / params that have to be injected before runtime

Page 37: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Strategies for Successful Automated Front-End Build Systems

• Use Yarn + NPM as package manager for app and dev dependencies

• Use Gulp as task runner to automate build / compile steps for different environments

• Angular2 / React - use Webpack as module bundler and base build system

• Goal: to control/run builds with simple CLI commands and JSON config files

Page 38: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

NPM

• Package Manager that runs on Node

• Makes it super easy to add, remove, upgrade dev and app dependencies

• Can store common tasks in scripts in package.json, which get run by team members or cloud servers

Page 39: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Yarn

• A new JavaScript package manager built by Facebook, Google, Exponent and Tilde

• Makes NPM installs more consistent (100% deterministic) and much faster with better caching

• Big code bases have seen a 10x reduction in install times

• Also locks down your NPM dependencies by default

Page 40: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Gulp

• Task runner / streaming build system

• Lets your devs write highly customizable build code in the language they use every day / best language ever: JS

• Uses Node’s file streaming to give you fast builds that don't write intermediary files to disk

Page 41: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Webpack

• Began as a module bundler but has become incredibly powerful tool for building modern web apps

• Treats everything - literally everything (JS/HTML/CSS/Images/Fonts) as a module - and then figures out what modules need to be loaded at any time

Page 42: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Webpack

• Powerful features:

• Hot Module Replacement

• Tree Shaking

• Caching

• Code Splitting / Commons Chunking

Page 43: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps
Page 44: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps
Page 45: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Dev Prod

Test

Page 46: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Demo

Page 47: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

3. TestEnsuring UX Quality with E2E Tests

Page 48: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Modern browsers are better at following standards / spec than 5-10 years ago, but still lots of

gotchas…

Page 49: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

And how do you know what you just built / added didn’t break

something else?

Page 50: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Problem: you may have to actually click / interact with app

to verify UX

Page 51: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Solution: Automated E2E Tests

Page 52: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

1. Script a browser to do what your users commonly do

Page 53: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

2. Record browser’s activity and save to the cloud

Page 54: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

3. QA and Chill

Page 55: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Selenium Webdriver

• Selenium is a suite of tools specifically for automating web browsers

• Webdriver allows you to drive a browser natively as a user would either locally or on a remote machine using the Selenium Server

• Key: can pilot any web browser using a standardized API

Page 56: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Protractor• End-to-end test framework for AngularJS

applications

• Runs tests against your application running in a real browser, interacting with it as a user would (wraps / uses Selenium Webdriver)

• Key: automatic waiting - don’t have to worry about waiting for your test and webpage to sync, can automatically execute the next step in your test the moment the webpage finishes pending tasks

Page 57: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Other Tools

• Nightwatch.js

• runs on NodeJS, still leverages Selenium

• big in the React community

• has it’s own cloud testing platform, NightCloud

Page 58: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Demo

Page 59: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

4. DeployEnabling CI and CD with Azure and VSTS

Page 60: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Basic Setup

• 2 builds (debug + release)

• 1 Linux build agent

• 3 release environments (dev + test + prod)

• 1 Cloud test capture service (Browserstack)

Page 61: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Build Process

Page 62: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps
Page 63: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps
Page 64: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps
Page 65: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps
Page 66: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps
Page 67: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Release Process

Page 68: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

1. Unpackage relevant zip

2. Replace

config tokens with env vars

3. Repackage relevant zip

Page 69: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Release Process Cont’d…

• Automatic release to dev and test

• Dev gets debug build, test gets release build

• For test environment

• Run e2e / smoke tests

• Store videos in Browserstack and test results in VSTS

• Deploy to prod

• Can be manual (after review of e2e / smoke tests)

• Or can be automatic if e2e tests are passing

Page 70: Front End from the Front Lines: Building Testing and Deploying Modern Web Apps

Thank You!