Testing at Yammer with FooUnit, Jellyfish, and Sauce Labs

Post on 27-Jan-2015

112 views 3 download

Tags:

description

 

Transcript of Testing at Yammer with FooUnit, Jellyfish, and Sauce Labs

Test Your Shit

Friday, July 22, 11

Test Your Shit...please

Friday, July 22, 11

bob remeika

Friday, July 22, 11

foobarfighter(twitter, github and freenode)

Friday, July 22, 11

i work at

Friday, July 22, 11

larry wall is my jesus

Friday, July 22, 11

so testing...

Friday, July 22, 11

so testing... why?

Friday, July 22, 11

your codebase will evolve

Friday, July 22, 11

your priorities will change

Friday, July 22, 11

but you already knew that

Friday, July 22, 11

that means your code will change

Friday, July 22, 11

that means your code will change

often

Friday, July 22, 11

so what are you going to do about it?

Friday, July 22, 11

some of you will do nothing

Friday, July 22, 11

you will fail

Friday, July 22, 11

unless you’re facebook ;-)

Friday, July 22, 11

you’re not facebook

Friday, July 22, 11

you will hire new people

Friday, July 22, 11

they will break things

Friday, July 22, 11

tests help them ramp up

Friday, July 22, 11

better codez

Friday, July 22, 11

tests force decoupling

Friday, July 22, 11

separate the shit out of those concerns

Friday, July 22, 11

tests at yammera brief case study

Friday, July 22, 11

just ship™

Friday, July 22, 11

just ship™we launch features... not tests

Friday, July 22, 11

features are why we are having success

Friday, July 22, 11

but things are changing

Friday, July 22, 11

stability matters

Friday, July 22, 11

speed matters

Friday, July 22, 11

quality matters

Friday, July 22, 11

we share code internally

Friday, July 22, 11

we have a lot of paying customers now

Friday, July 22, 11

they are enterprises

Friday, July 22, 11

breaking them is not cool

Friday, July 22, 11

‘this.updateMessageList’ is not a method

Friday, July 22, 11

‘this.updateMessageList’ is not a method

you didn’t even run that code????????!?!!?!

Friday, July 22, 11

how could we have caught that?

Friday, July 22, 11

how could we have caught that?

we only had three javascript engineers

Friday, July 22, 11

our codebase was growing

Friday, July 22, 11

we needed to be more stable

Friday, July 22, 11

we needed some controls

Friday, July 22, 11

we needed some more beer

Friday, July 22, 11

so now we have tests

Friday, July 22, 11

(insert graph)

Friday, July 22, 11

fewer face palms

Friday, July 22, 11

better reliability

Friday, July 22, 11

improved new employee ramp up

Friday, July 22, 11

fearless refactoring

Friday, July 22, 11

because we rarely get it right the first time

Friday, July 22, 11

so testing...

Friday, July 22, 11

so testing... how?

Friday, July 22, 11

i can’t cover everything

Friday, July 22, 11

stop!

Friday, July 22, 11

go!

Friday, July 22, 11

you need a ci environment

Friday, July 22, 11

you might need unit tests

Friday, July 22, 11

you definitely need functional tests

Friday, July 22, 11

(c)ontinuous(i)ntegration

Friday, July 22, 11

we have this setup at yammer

hi my name is peterhi, i’m paul

i’m a street light

Friday, July 22, 11

if you are writing tests for the browser

Friday, July 22, 11

require(‘saucelabs’)

Friday, July 22, 11

use your vc money

Friday, July 22, 11

we use saucelabs at yammer

Friday, July 22, 11

Friday, July 22, 11

because it is awesome

Friday, July 22, 11

awesomesauce

Friday, July 22, 11

how do you know if you need unit tests?

Friday, July 22, 11

Friday, July 22, 11

unit tests

Friday, July 22, 11

convenience to the developer

Friday, July 22, 11

convenience to the next developer

Friday, July 22, 11

writing libraries

Friday, July 22, 11

require(‘unit tests’)// doesn’t run

Friday, July 22, 11

require(‘foounit’)// totally runs... teh asum

Friday, July 22, 11

foounita brief intro

Friday, July 22, 11

another javascript test framework

Friday, July 22, 11

another javascript test framework

really?

Friday, July 22, 11

... ya but

Friday, July 22, 11

it has some lofty goals

Friday, July 22, 11

cross host

Friday, July 22, 11

test shared code on client/server

Friday, July 22, 11

test shared code on client/server

these shenanigans exist at yammer

Friday, July 22, 11

test shared code on client/server

these shenanigans exist at yammeri’m not gonna lie, this is hard to do

Friday, July 22, 11

beautiful syntax

Friday, July 22, 11

not owned by the man

Friday, July 22, 11

where it’s going

Friday, July 22, 11

great ehraaahs

Friday, July 22, 11

great doc generation

Friday, July 22, 11

jellyfish integration

Friday, July 22, 11

ui sandboxing

Friday, July 22, 11

easy to use ui

Friday, July 22, 11

turn into a jet and fly into the sun

Friday, July 22, 11

var f = require(‘foounit’).globalize();

describe(‘this is a group’, function (){ it(‘has a test’, function (){ expect(myTest).to(runEverywhere); });});

f.run();

Friday, July 22, 11

it’s a lot like jasmine

Friday, July 22, 11

it’s a lot like jasminethere’s reasons for that

Friday, July 22, 11

check it outhttp://foounit.org

Friday, July 22, 11

functional tests

Friday, July 22, 11

test end result

Friday, July 22, 11

test your application

Friday, July 22, 11

test what the user sees

Friday, July 22, 11

require(‘jellyfish’)

Friday, July 22, 11

h8rz g0n h8

Friday, July 22, 11

h8rz g0n h8testing fallacies

Friday, July 22, 11

fallacy #1

Friday, July 22, 11

people will tell you that you don’t need tests

Friday, July 22, 11

let’s analyze that

Friday, July 22, 11

successful open source projects have tests

Friday, July 22, 11

rails

Friday, July 22, 11

one million tests

Friday, July 22, 11

jquery

Friday, July 22, 11

1336 tests

Friday, July 22, 11

dojo

Friday, July 22, 11

1337 tests

Friday, July 22, 11

1337 testsone more than jquery cause it’s better

Friday, July 22, 11

1337 testsone more than jquery cause it’s better

l337

Friday, July 22, 11

you want to be successful, right?

Friday, July 22, 11

you want to be successful, right?

write tests

Friday, July 22, 11

if you really care about the numbers

Friday, July 22, 11

if you really care about the numbersyou can run the suites yourself

Friday, July 22, 11

fallacy #2

Friday, July 22, 11

you don’t need to test view code

Friday, July 22, 11

you don’t need to test view code

if your ‘view code’ is just html... cool

Friday, July 22, 11

you don’t need to test view code

if your ‘view code’ is just html... coolbut you are building a big client side app

Friday, July 22, 11

do you consider jquery to be just ‘view code’?

Friday, July 22, 11

no

Friday, July 22, 11

it has a lot of tests

Friday, July 22, 11

because it’s complicated

Friday, July 22, 11

complex ui interactions are not just ‘view code’

Friday, July 22, 11

fallacy #3

Friday, July 22, 11

tests slow you down

Friday, July 22, 11

until the next guy needs to change

something

Friday, July 22, 11

until you spend hours face palming

Friday, July 22, 11

until you need to test error conditions

Friday, July 22, 11

fallacy #4

Friday, July 22, 11

you need 100% coverage

Friday, July 22, 11

you aren’t building the space shuttle

Friday, July 22, 11

you don’t even need 90%

Friday, July 22, 11

you need enough to help you refactor with

confidence

Friday, July 22, 11

it’s hard to find the balance

Friday, July 22, 11

but you should try

Friday, July 22, 11

what’s a good unit test?

Friday, July 22, 11

tdd/bdd dictates that you should test

everything

Friday, July 22, 11

sure you can do that

Friday, July 22, 11

... if you have that culture

Friday, July 22, 11

i’m looking at you pivots

Friday, July 22, 11

but there are diminishing returns

Friday, July 22, 11

this.prototype.start = function (){ if (this.isStarted()){ return; } this._start()}

Friday, July 22, 11

find a happy place

Friday, July 22, 11

some things are hard to test

Friday, July 22, 11

your mileage will vary

Friday, July 22, 11

emulating xhr

Friday, July 22, 11

multi-step interactions

Friday, July 22, 11

consider integration tests

Friday, July 22, 11

mock services ftw

Friday, July 22, 11

please talk to me

Friday, July 22, 11

or contact me online

Friday, July 22, 11

i actually like people

Friday, July 22, 11

foobarfighter(twitter, github and freenode)

Friday, July 22, 11

foounithttp://foounit.org

Friday, July 22, 11