Ruby on Rails Automated Testing You're doing it wrong
Dec 25, 2014
Ruby on Rails
Automated Testing
You're doing it wrong
Ruby on Rails
Automated Testing
You're doing it wrong
...maybe
Ruby on Rails:
[ ruby.about.com ]
Ruby on Rails:Model-View-Controller framework
for creating
database-driven websites in Ruby
Ruby on Rails:
[ rubyonrails.org ]
srsly, though,
How do I go about learning
Ruby on Rails??
it's a gameyou're doing
it right!
free book
free book
excellent video series
excellent video series (not free)
3 more chancesto learn more about ruby
challengingchallenging
Ruby on Rails:
… … if you're doing it right.if you're doing it right.[ my definition ]
excitingexciting
Ruby on Rails:
… … if you're doing it right.if you're doing it right.[ my definition ]
ffuunn… … if you're doing it right.if you're doing it right.
Ruby on Rails:
[ my definition ]
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 ]
[ 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::
ffuunnprogramming is
ffuunnmaking progressmaking progress is is ffuunn
[ my definition ]
solving problemssolving problems is is ffuunnmaking people happymaking people happy is is ffuunn
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
automated testing
+
BDD
=-) cool
flow
Csíkszentmihályi
Mr.Positive
Psychology
=
our brains can process about 110 bits each second
conversing requires about 60 bits each second
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
the secretto
happiness
flow
110 bits
Clear goals that, while
challenging, are still
attainable.
110 bits
Strong concentration and focused
attention.
110 bits
The activity is intrinsically
rewarding.
110 bits
Feelings of serenity; a loss of feelings of
self-consciousness.
110 bits
Timelessness... so focused on
the present that you lose track of
time passing.
110 bits
Immediate feedback.
110 bits Knowing the task
is doable
a balance between skill level
and challenge
110 bits Feelings of
personal control over the situation
and the outcome.
110 bits
Lack of awareness of physical
needs.
110 bits
Complete focus on
the activity itself.
110 bits
110 bits
is not very much
110 bits
is not very much
especially when you're talking about
110 bits
is not very much
especially when you're talking about
a complex task
110 bits
is not very much
especially when you're talking about
a complex task
like programming
110 bits
[ Sol Tanguay, Imarklab ]
Separate thinking and execution to execute
faster and think better.
110 bits
BDD:Behavior-Driven
Development
110 bits
Describe behavior in plain text
110 bits
[ Sol Tanguay, Imarklab ]
Separate thinking and execution to execute
faster and think better.
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.
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.
Translate to Cucumber speak
(minimal) fancy syntax
Cucumber features can be understood
by various stakeholders (not just developers)
Cucumber features can be
by your project manager
writtenrun
by testers or QA
Cucumber features can be
by your project manager
writtenrun
by testers or QA
...you're doing itright
Cucumber features can be
runby testers or QA...
(as well as by developers)
Cucumber features can be
runby testers or QA
= automated testing
SO, we have our cucumber feature...
What's next?
Get your coding on!
Not yet.
Cucumber wants to help... (so let it)
Seeing red, yellow is important
You're doing it wrong if
you don't see red first
green is the new red
Seeing red is important: rspec
This test has an error, and may never fail.
This test may never fail. rspec
To know it's good, you have to see it bad
This test can fail. rspec
Run this, see red! You're doing it right!
Cucumber features can be
runyour tests (cucumber, rspec)
before you code
seeing red is good
it's a gameYour objective:
go red go green...
it's a game
finish green...
remember...
flow?
110 bits
Clear goals that, while
challenging, are still
attainable.
Cucumber Once you've written your features, cucumber reminds you of your goals again (and again).
110 bits
Strong concentration and focused
attention.
Cucumber 110 bits... 50 too many? Distractions vying for your attention? Run cucumber. (bookmark that amazing video for later)
110 bits
Feelings of serenity; a loss of feelings of
self-consciousness.
Ask for space (time) without interruptions so you can
concentrate and get things done.`
110 bits
Immediate feedback.
feedback immediately.
Automated testing tools
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
110 bits
behavior-driven developmentbehavior-driven development
presentspresents
clear and challenging goals clear and challenging goals
in byte-sized pieces.in byte-sized pieces.
the secretto
happiness
flow
110 bits
flow
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