OpenWest Conference at UVU, Ruby on Rails and BDD

94
Ruby on Rails Automated Testing You're doing it wrong

description

Rails, programming

Transcript of OpenWest Conference at UVU, Ruby on Rails and BDD

Page 1: OpenWest Conference at UVU, Ruby on Rails and BDD

Ruby on Rails

Automated Testing

You're doing it wrong

Page 2: OpenWest Conference at UVU, Ruby on Rails and BDD

Ruby on Rails

Automated Testing

You're doing it wrong

...maybe

Page 3: OpenWest Conference at UVU, Ruby on Rails and BDD

Ruby on Rails:

Page 4: OpenWest Conference at UVU, Ruby on Rails and BDD

[ ruby.about.com ]

Ruby on Rails:Model-View-Controller framework

for creating

database-driven websites in Ruby

Page 5: OpenWest Conference at UVU, Ruby on Rails and BDD

Ruby on Rails:

[ rubyonrails.org ]

Page 6: OpenWest Conference at UVU, Ruby on Rails and BDD
Page 7: OpenWest Conference at UVU, Ruby on Rails and BDD
Page 8: OpenWest Conference at UVU, Ruby on Rails and BDD
Page 9: OpenWest Conference at UVU, Ruby on Rails and BDD

srsly, though,

How do I go about learning

Ruby on Rails??

Page 10: OpenWest Conference at UVU, Ruby on Rails and BDD
Page 11: OpenWest Conference at UVU, Ruby on Rails and BDD

it's a gameyou're doing

it right!

Page 12: OpenWest Conference at UVU, Ruby on Rails and BDD
Page 13: OpenWest Conference at UVU, Ruby on Rails and BDD

free book

Page 14: OpenWest Conference at UVU, Ruby on Rails and BDD

free book

Page 15: OpenWest Conference at UVU, Ruby on Rails and BDD

excellent video series

Page 16: OpenWest Conference at UVU, Ruby on Rails and BDD

excellent video series (not free)

Page 17: OpenWest Conference at UVU, Ruby on Rails and BDD

3 more chancesto learn more about ruby

Page 18: OpenWest Conference at UVU, Ruby on Rails and BDD

challengingchallenging

Ruby on Rails:

… … if you're doing it right.if you're doing it right.[ my definition ]

Page 19: OpenWest Conference at UVU, Ruby on Rails and BDD

excitingexciting

Ruby on Rails:

… … if you're doing it right.if you're doing it right.[ my definition ]

Page 20: OpenWest Conference at UVU, Ruby on Rails and BDD

ffuunn… … if you're doing it right.if you're doing it right.

Ruby on Rails:

[ my definition ]

Page 21: OpenWest Conference at UVU, Ruby on Rails and BDD

a billion other peoplea billion other people

just like youjust like you

who are happy to helpwho are happy to help

(that's why FOSS is (that's why FOSS is soosoo cool!) cool!)

Ruby on Rails:

[ my definition ]

Page 22: OpenWest Conference at UVU, Ruby on Rails and BDD

[ my definition ]

part of the FOSS part of the FOSS

community! So if you're learning community! So if you're learning

from others, and teaching others,from others, and teaching others,

...you're doing it right!...you're doing it right!

yyoouu::

Page 23: OpenWest Conference at UVU, Ruby on Rails and BDD

ffuunnprogramming is

Page 24: OpenWest Conference at UVU, Ruby on Rails and BDD

ffuunnmaking progressmaking progress is is ffuunn

[ my definition ]

solving problemssolving problems is is ffuunnmaking people happymaking people happy is is ffuunn

Page 25: OpenWest Conference at UVU, Ruby on Rails and BDD

nono f fuunnbeing stuckbeing stuck is is no no funfun

[ my definition ]

having no problems to solvehaving no problems to solve is is nono fun fun

not knowing what people wantnot knowing what people want is is nono fun fun

Page 26: OpenWest Conference at UVU, Ruby on Rails and BDD

automated testing

Page 27: OpenWest Conference at UVU, Ruby on Rails and BDD

+

Page 28: OpenWest Conference at UVU, Ruby on Rails and BDD

BDD

Page 29: OpenWest Conference at UVU, Ruby on Rails and BDD

=-) cool

Page 30: OpenWest Conference at UVU, Ruby on Rails and BDD

flow

Page 31: OpenWest Conference at UVU, Ruby on Rails and BDD

Csíkszentmihályi

Page 32: OpenWest Conference at UVU, Ruby on Rails and BDD
Page 33: OpenWest Conference at UVU, Ruby on Rails and BDD

Mr.Positive

Psychology

=

Page 34: OpenWest Conference at UVU, Ruby on Rails and BDD

our brains can process about 110 bits each second

conversing requires about 60 bits each second

Page 35: OpenWest Conference at UVU, Ruby on Rails and BDD

110 bits

we attain fl ow when faced withwe attain fl ow when faced with

clear and challenging goals clear and challenging goals

that stretch our abilities that stretch our abilities

without overtaxing themwithout overtaxing them

Page 36: OpenWest Conference at UVU, Ruby on Rails and BDD
Page 37: OpenWest Conference at UVU, Ruby on Rails and BDD

the secretto

happiness

flow

Page 38: OpenWest Conference at UVU, Ruby on Rails and BDD

110 bits

Clear goals that, while

challenging, are still

attainable.

Page 39: OpenWest Conference at UVU, Ruby on Rails and BDD

110 bits

Strong concentration and focused

attention.

Page 40: OpenWest Conference at UVU, Ruby on Rails and BDD

110 bits

The activity is intrinsically

rewarding.

Page 41: OpenWest Conference at UVU, Ruby on Rails and BDD

110 bits

Feelings of serenity; a loss of feelings of

self-consciousness.

Page 42: OpenWest Conference at UVU, Ruby on Rails and BDD

110 bits

Timelessness... so focused on

the present that you lose track of

time passing.

Page 43: OpenWest Conference at UVU, Ruby on Rails and BDD

110 bits

Immediate feedback.

Page 44: OpenWest Conference at UVU, Ruby on Rails and BDD

110 bits Knowing the task

is doable

a balance between skill level

and challenge

Page 45: OpenWest Conference at UVU, Ruby on Rails and BDD

110 bits Feelings of

personal control over the situation

and the outcome.

Page 46: OpenWest Conference at UVU, Ruby on Rails and BDD

110 bits

Lack of awareness of physical

needs.

Page 47: OpenWest Conference at UVU, Ruby on Rails and BDD

110 bits

Complete focus on

the activity itself.

Page 48: OpenWest Conference at UVU, Ruby on Rails and BDD

110 bits

Page 49: OpenWest Conference at UVU, Ruby on Rails and BDD

110 bits

is not very much

Page 50: OpenWest Conference at UVU, Ruby on Rails and BDD

110 bits

is not very much

especially when you're talking about

Page 51: OpenWest Conference at UVU, Ruby on Rails and BDD

110 bits

is not very much

especially when you're talking about

a complex task

Page 52: OpenWest Conference at UVU, Ruby on Rails and BDD

110 bits

is not very much

especially when you're talking about

a complex task

like programming

Page 53: OpenWest Conference at UVU, Ruby on Rails and BDD
Page 54: OpenWest Conference at UVU, Ruby on Rails and BDD

110 bits

[ Sol Tanguay, Imarklab ]

Separate thinking and execution to execute

faster and think better.

Page 55: OpenWest Conference at UVU, Ruby on Rails and BDD

110 bits

BDD:Behavior-Driven

Development

Page 56: OpenWest Conference at UVU, Ruby on Rails and BDD

110 bits

Page 57: OpenWest Conference at UVU, Ruby on Rails and BDD

Describe behavior in plain text

Page 58: OpenWest Conference at UVU, Ruby on Rails and BDD

110 bits

[ Sol Tanguay, Imarklab ]

Separate thinking and execution to execute

faster and think better.

Page 59: OpenWest Conference at UVU, Ruby on Rails and BDD

Describe behavior in plain text

We'd like for users to be able todeposit money in their bank accountand have the balance reflect that deposit immediately.

Page 60: OpenWest Conference at UVU, Ruby on Rails and BDD

Unfettered thinking

Describe behavior in plain text

We'd like for users to be able todeposit money in their bank accountand have the balance reflect that deposit immediately.

Page 61: OpenWest Conference at UVU, Ruby on Rails and BDD

Translate to Cucumber speak

(minimal) fancy syntax

Page 62: OpenWest Conference at UVU, Ruby on Rails and BDD

Cucumber features can be understood

by various stakeholders (not just developers)

Page 63: OpenWest Conference at UVU, Ruby on Rails and BDD

Cucumber features can be

by your project manager

writtenrun

by testers or QA

Page 64: OpenWest Conference at UVU, Ruby on Rails and BDD

Cucumber features can be

by your project manager

writtenrun

by testers or QA

...you're doing itright

Page 65: OpenWest Conference at UVU, Ruby on Rails and BDD

Cucumber features can be

runby testers or QA...

(as well as by developers)

Page 66: OpenWest Conference at UVU, Ruby on Rails and BDD

Cucumber features can be

runby testers or QA

= automated testing

Page 67: OpenWest Conference at UVU, Ruby on Rails and BDD

SO, we have our cucumber feature...

What's next?

Page 68: OpenWest Conference at UVU, Ruby on Rails and BDD

Get your coding on!

Page 69: OpenWest Conference at UVU, Ruby on Rails and BDD

Not yet.

Page 70: OpenWest Conference at UVU, Ruby on Rails and BDD

Cucumber wants to help... (so let it)

Seeing red, yellow is important

Page 71: OpenWest Conference at UVU, Ruby on Rails and BDD

You're doing it wrong if

you don't see red first

Page 72: OpenWest Conference at UVU, Ruby on Rails and BDD

green is the new red

Page 73: OpenWest Conference at UVU, Ruby on Rails and BDD

Seeing red is important: rspec

This test has an error, and may never fail.

Page 74: OpenWest Conference at UVU, Ruby on Rails and BDD

This test may never fail. rspec

To know it's good, you have to see it bad

Page 75: OpenWest Conference at UVU, Ruby on Rails and BDD

This test can fail. rspec

Run this, see red! You're doing it right!

Page 76: OpenWest Conference at UVU, Ruby on Rails and BDD

Cucumber features can be

runyour tests (cucumber, rspec)

before you code

Page 77: OpenWest Conference at UVU, Ruby on Rails and BDD

seeing red is good

Page 78: OpenWest Conference at UVU, Ruby on Rails and BDD

it's a gameYour objective:

go red go green...

Page 79: OpenWest Conference at UVU, Ruby on Rails and BDD

it's a game

finish green...

Page 80: OpenWest Conference at UVU, Ruby on Rails and BDD

remember...

Page 81: OpenWest Conference at UVU, Ruby on Rails and BDD

flow?

Page 82: OpenWest Conference at UVU, Ruby on Rails and BDD

110 bits

Clear goals that, while

challenging, are still

attainable.

Page 83: OpenWest Conference at UVU, Ruby on Rails and BDD

Cucumber Once you've written your features, cucumber reminds you of your goals again (and again).

Page 84: OpenWest Conference at UVU, Ruby on Rails and BDD

110 bits

Strong concentration and focused

attention.

Page 85: OpenWest Conference at UVU, Ruby on Rails and BDD

Cucumber 110 bits... 50 too many? Distractions vying for your attention? Run cucumber. (bookmark that amazing video for later)

Page 86: OpenWest Conference at UVU, Ruby on Rails and BDD

110 bits

Feelings of serenity; a loss of feelings of

self-consciousness.

Page 87: OpenWest Conference at UVU, Ruby on Rails and BDD

Ask for space (time) without interruptions so you can

concentrate and get things done.`

Page 88: OpenWest Conference at UVU, Ruby on Rails and BDD

110 bits

Immediate feedback.

Page 89: OpenWest Conference at UVU, Ruby on Rails and BDD

feedback immediately.

Automated testing tools

Page 90: OpenWest Conference at UVU, Ruby on Rails and BDD

110 bits

we attain fl ow when faced withwe attain fl ow when faced with

clear and challenging goals clear and challenging goals

that stretch our abilities that stretch our abilities

without overtaxing themwithout overtaxing them

Page 91: OpenWest Conference at UVU, Ruby on Rails and BDD

110 bits

behavior-driven developmentbehavior-driven development

presentspresents

clear and challenging goals clear and challenging goals

in byte-sized pieces.in byte-sized pieces.

Page 92: OpenWest Conference at UVU, Ruby on Rails and BDD

the secretto

happiness

flow

Page 93: OpenWest Conference at UVU, Ruby on Rails and BDD

110 bits

flow

Page 94: OpenWest Conference at UVU, Ruby on Rails and BDD

where all this stuff came fromwhere all this stuff came fromafrica photos

http://publicphoto.org/

Going on a Testing Anti-Pattern Safari, Aja Hammerly, MWRC 2013

http://confreaks.com/videos/2345-mwrc2013-going-on-a-testing-anti-pattern-safari

imagesTexture Backgrounds, Wright Brothers,

jet, photos, artwork, cartoons, abstract arthttp://www.thepublicdomain.net/

Csíkszentmihályi photohttps://commons.wikimedia.org/wiki/Main_Page

bullhttp://www.publicdomainpictures.net/view-image.php?image=38586&picture=bull-5

Finding Flow, CsíkszentmihályiCsíkszentmihályi

https://www.ted.com/talks/mihaly_csikszentmihalyi_on_flow.html

quote: flowhttp://psychology.about.com/od/PositivePsy

chology/a/flow.htm