• Unit Of Work• Setup Methods
• Constrained vs. Unconstrained Isolation
Frameworks• Principles of Good Isolation Frameworks
• Faking Deep Legacy is OK• Six Influence Forces
• Beautiful Builds
Bottleneck Ninja Test Review Lion Build Bear
Unit
Of W
orkProduction
Code
Unit Of Work
Return Value/Exceptio
nNoticeable
State Change 3rd Party call
Public API
Test
Production Code
Unit Of Work
Return Value/Exceptio
n
Public API
Assert Test
Production Code
Unit Of Work
Noticeable State Change
Test
Public API
Asse
rt
Production Code
Unit Of Work
3rd Party call
Test
Public API As
sert
3rd Party
Unit Of Work
Production Code
Unit Of Work
3rd Party call
Test
Public API As
sert
3rd Party
Unit Of Work
Mock
Nam
ing
by U
nit
Of W
ork
UnitOfWork_Input_ExpectedOutput
UnitOfWork_LogicalAction_ExpectedChangeInBehavior
UnitOfWork_ActionOrInput_ExepectedCallToThirdParty
Nam
ing
by U
nit
Of W
ork
Addition_PositiveNumbers_ReturnsSum()
Addition_WhenCalled_ResetsTheNextSum() Addition_NegativeNumber
s_CallsLogger()
Setu
p Me
thod
s
Isola
tion
Fram
ewor
ks Constrained vs. Unconstrained
Good
bye
Rhin
oMoc
ks Hello FakeItEasy,
NSubstitute
Isola
tion
fram
ewor
ks Fu
ture
s
Usability Readability Good Errors Simplicity Robust future proof tests Less over specification
Non strict Recursive Fakes
Rspec style is ok
Assert multiple results on
same unit of work
LEGACY CODEFaking Deep
System Internals is OKExample - SilverUnit
Cross Cutting Fakes
Old code
Old code FakeNewcode
CROSS CUTTING FAKES
Impacting Change
6 in
fluen
ce
forc
es
Personal Ability Motivation Social Ability Motivation Environmental Ability Motivation
Anot
her b
ook?
Tool
s
Pex – yes Moles (ms fakes) – NO JustMock - Maybe Nuget – YES Chocolatey – YES
TeamCity – YES FinalBuilder – YES Ruby and Rake – Maybe Amazon AWS agent hosting –
YES Git for very small commits -
YES
Build and Delivery
Build Patterns
Build
Scr
ipt
Inje
ctio
n Allow version aware builds Build scripts are part
of source control Build configurations on
the CI server are dumb triggers
Extra
ct S
crip
t
Extract Script
Build Chain Triggers
Triggered by checkin
Triggered by end of previous
Manual
Manual
Build Chaining
Slow Builds
Do X
Do X + Y
Do X + Y + Z
Do X + y + Z + N
Cumulative, Fast Builds
Do X
Do Y
Do Z
Do N
How Fast?
Extract Script Shipping Skeleton Fill in the blanks Cumulative Builds Build Waves Location Agnostic
BeautifulBuilds.com
(wtf how many books?)
Cour
ses I
’m
Doin
g
Beautiful builds TDD with JS TDD with Ruby Art of Unit Testing in .NET from scratch [email protected]
Norway & Sweden Osherove.com for info
A sh
ort s
ong?
This is a test line
It looks like you’re
doing just fine
It’s time for a
song of mine
It’s late in the evening
It’s l
ate
in th
e ev
enin
g
I’m wondering what words to say It’s so hard to breath
here The customer’s face is gray
And then he asks me
Is the product
alright?
And I say
“yes, we deploy it all tonight”
I check in the changes
I check in the changes
The code doesn’t even
compile
I wish I was home now
Instead I fake a big smile
And when they ask me
Is the code alright?
I say
“yes, it seems to
compile tonight’
I feel horribleBecause I see
The sadness in
their eyes
When they find out
That the product
Doesn’t even have
log files
This thing is
doomed
It’s time to go
home nowAnd I’ve got an aching
head
So I lock my computer
And pray that tomorrow
I’m dead
When my wife asks me
“Do you feel
alright?”
I say “yes. Let’s watch game of thrones tonight”
I fee
l mise
rabl
e Because I’ll guess The madness in their
talk
When they find out that tomorrow I don’t plan to come to work And write my CV
Than
k yo
u!
Beautiful builds TDD with JS TDD with Ruby Art of Unit Testing in .NET from scratch [email protected]
@RoyOsherove Norway & Sweden