Liz Keogh
@lunivore
http://lizkeogh.com
An Introduction to TDD
How to TDD People!
An Introduction to Cynefin
Refactoring People and Life
Test-Driven Experiments
TDD All the Things!
Write a
failing
test
Make it
pass
Refactor
New
behaviour
public bool WaitFor(AutomationElementWrapper element,
SomethingToWaitFor check,
TimeSpan timeout, FailureToHappenHandler failureHandler,
IEnumerable<AutomationEventWrapper> events)
{
Monitor.Enter(_waitingRoom);
_triggeringEvent = null;
DateTime started = DateTime.Now;
var handlerRemovers = AddPulsingHandlers(events, element);
bool checkPassed = true;
while (!check(element, _triggeringEvent) &&
DateTime.Now.Subtract(started).CompareTo(timeout) < 0)
{
checkPassed = false;
Monitor.Wait(_waitingRoom, timeout);
}
Monitor.Exit(_waitingRoom);
ClearPulsingHandlers(handlerRemovers);
if (!checkPassed && !check(element, null))
{
failureHandler(element);
return false;
}
return true;
}
public void ShouldWaitForEventsToOccur()
{
// Given an automation element
_window = LaunchPetShopWindow();
var combo = _window.Find<ComboBox>("petFoodInput");
// When we cause a slow event on that element
new Thread(() =>
{
Thread.Sleep(200);
combo.Select("PetFood[Carnivorous]");
}).Start();
// And we wait for the event
var eventOccurred = false;
new Waiter().WaitFor(
combo, (src, e) => {
eventOccurred = true;
return combo.Selection.Equals("PetFood[Carnivorous]");
},
new TimeSpan(0, 0, 1),
(ex) => Assert.Fail(),
new List<AutomationEventWrapper> {
new StructureChangeEvent(TreeScope.Element)});
// Then we should be notified when the event occurs
Assert.IsTrue(eventOccurred);
}
public void ShouldWaitForEventsToOccur()
{
// Given an automation element
_window = LaunchPetShopWindow();
var combo =
_window.Find<ComboBox>("petFoodInput");
// When we cause a slow event on that element
new Thread(() =>
{
Thread.Sleep(200);
combo.Select("PetFood[Carnivorous]");
}).Start();
// And we wait for the event
var eventOccurred = false;
new Waiter().WaitFor(combo, (src, e) =>
{
eventOccurred = true;
return combo.Selection.Equals(
"PetFood[Carnivorous]");
}, new TimeSpan(0, 0, 1),
(ex) => Assert.Fail(),
new List<AutomationEventWrapper> {
new StructureChangeEvent(
TreeScope.Element)});
// Then we should be notified
// when the event occurs
Assert.IsTrue(eventOccurred);
}
ShouldWaitForEventsToOccur
Given an automation element
When we cause a slow event
on that element
And we wait for the event
Then we should be notified
when the event occurs.
Examples
Given a context
When an event happens
Then an outcome should occur
Arrange
Act
Assert
Given a context
When an event happens
Then an outcome should occur
Arrange
Given a context
When an event happens
Then an outcome should occur
Act
Given a context
When an event happens
Then an outcome should occur
Assert
An Example of an Example
Given Fred has bought a microwave
And the microwave cost £100
When we refund the microwave
Then Fred should be refunded £100.
With Pixies!
Given Fred has bought a microwave
And the microwave cost £100
When we refund the microwave
Then Fred should be refunded £100.
Let’s TDD a non-software process!
TDD All the Things!
Let’s TDD a person!
Write a
failing
test
New
behaviour
Feedback
Given a context
When an event happens
Then an outcome should occur
Context in
which they
act
Feedback
Given a context
When an event happens
Then an outcome should occur
Action they
take
Feedback
Given a context
When an event happens
Then an outcome should occur
Outcomes
Refactor
Existing
behaviour
and anchor
what you value!
Number 1 rule of
feedback:
Anchor what you value!
Write a
failing
test
Refactor
Existing
behaviour
and anchor
what you value!
New
behaviour
Write a
failing
test
Refactor
Existing
behaviour
and anchor
what you value!
Make it
pass
New
behaviour
Describe
desired
behaviour
Change
the
behaviour
The sandwich model
Start with something good
Say something bad
Finish with something good
The sandwich model done right
Anchor what you value
Describe desired behaviour
THEN change the behaviour
(People can do this bit themselves!)
TDD All the Things!
The Innovation Cycle
Commodities
Differentiators
Repeatability
Spoilers
Cynefin
Obvious
ComplicatedComplex
Chaotic
With thanks to
David Snowden and Cognitive Edge
Cynefin
With thanks to
David Snowden and Cognitive Edge
Disorder
Cynefin
ObviousChaotic
With thanks to
David Snowden and Cognitive Edge
Estimating Complexity
5. Nobody has ever done it before
4. Someone outside the org has done it before
(probably a competitor)
3. Someone in the company has done it before
2. Someone in the team has done it before
1. We all know how to do it.
Estimating Complexity
5 4 3
2
1
TDD All the Things!
Refactoring code
Make it run
Get the thing
that’s new
working
Make it right
Make it
fast
Separate concerns
so you can
do more!
Good code
Focus on responsibilities and strengths
Is generous on input, strict on output
Is easy to understand and work with
You can trust clean code.
Dan North’s “Three Ages”
Explore
Optimise for
Discovery
Stabilize
Optimize for
Repeatability
Commoditize
Optimize for
Efficiency
TDD All the Things!
Refactoring at scale
Horizon 3
Horizon 2
Horizon
1
Refactoring people
Try it out
Get the thing
that’s new
working
Focus on
strengths
Use others for
the boring
stuff!
Separate concerns
so you can
do more!
TDD All the Things!
Good people
Focus on responsibilities and strengths
Are generous in listening, honest in speaking
Are easy to understand and work with
You can trust good people.
Horizon 2
fights for budget
with Horizon 1.
Focusing on strengths
fights for time
with the boring stuff.
Trust other people’s code.
Trust other people.
Let’s TDD a people process!
Let’s TDD a people process
(Thanks Tobias!)
Given my son’s room is a mess
When I ask him to clean it up
Then the room should be clean.
SMART criteria
Specific
Measurable
Achievable
Relevant
Timebound
Well-formed outcomes
Sensation
Vision
Hearing
Smell
Taste
Well-formed outcomes
Given my son’s room is a mess
When I ask him to clean it up
Then the room should be clean.
GROW
Goal
Reality
Options
Way forward
GROW
Given a context
When an event happens
Then an outcome should occur
Goal
GROW
Given a context
When an event happens
Then an outcome should occur
Reality
GROW
Given a context
When an event happens
Then an outcome should occur
Options /
Way Forward
Life doesn’t have
bugs,
just
apologies
Real Options
Options
have value
Options
expire
Never commit early
unless you know why
TDD All the Things!
BDD
Context
Event
Outcome
Test
Deliberate Discovery
A Naïve Scenario
CONTEXT EVENT OUTCOME
Well-formed
outcome
Event which
leads
to the
outcome
Reality.
It’s all good,
right?
A Naïve Scenario
Given my son’s room is a mess
When I ask him to clean it up
Then the room should be clean.
Tom Gilb’s “Mafia Offer”
Given my son’s room is a mess
When I ask him to clean it up
Then the room should be clean
And he looks really miserable
and hates you?
Reality.
It’s all good,
right?
Unwanted context
CONTEXT EVENT OUTCOME
Well-formed
outcome
Event which
leads
to the
outcome
Unwanted
Context
Unwanted
Outcome!
Unwanted
Context
Subgoals
CONTEXT EVENT OUTCOME
Well-formed
outcome
Event which
leads
to the
outcome
Replacement
context
Unwanted
Outcome!
Given Scenario
CONTEXT EVENT OUTCOME
Well-formed
outcome
Event which
leads
to the
outcome
Unwanted
Context
Replacement
context
EVENT OUTCOME
Event which
leads to
replacement
Replacing the “Mafia Offer”
Given my son knows
what “clean” looks like
And that it will make me say “Wow!”
And be impressed with him
Given my son’s room is a mess
When I ask him to clean it up
Then the room should be clean
And he should be happy!
Changing reality
CONTEXT EVENT OUTCOME
Well-formed
outcome
Event which
leads
to the
outcome
Unwanted
Context
Replacement
context
EVENT
Event which
leads
to the
replacement
CONTEXT
TDD All the Things!
TDD All the Things!
TDD All the Things!
TDD All the Things!
TDD All the Things!
TDD All the Things!
Cynefin
Obvious
ComplicatedComplex
Chaotic
With thanks to
David Snowden and Cognitive Edge
Sense
Categorize
Respond
Sense
Analyze
Respond
Probe
Sense
Respond
Act
Sense
Respond
Whenever we do anything
new
we will make
discoveries
Cynefin
Trying
things
out Probe
Experiment
How to use scenarios…
…in this
space.
Deliberate Discovery
Assume ignorance
Assume second order ignorance
Optimize for discovery
Real Options
Options have value
Options expire
Never commit early
unless you know why
TDD All the Things!
TDD All the Things!
A Safe-To-Fail Probe has…
A way of knowing it’s succeeding
A way of knowing it’s failing
A way of dampening it
A way of amplifying it
Coherence
Coherence
A reason for thinking that
the probe might have
a positive impact
Can you think of
a scenario
in which this experiment
succeeds?
Success Scenarios
Given my client has a problem
When I suggest a practice to help
Then they should be able to deliver
software.
Success Scenarios
Given Fred has signed up for Appytastic
When we sync to Facebook by default
Then Fred’s friends should see
how awesome Appytastic is!
Complementary Success Scenarios
Given Fred has signed up for Appytastic
When we sync to Facebook by default
Then Fred should realise that Appytastic
is a really easy way to get content
onto Facebook!
Conflicting Success Scenarios!
Given my client has a problem
When I suggest a practice to help
Then it should help them to think of
different practices
that really are helpful!
Failure Scenarios
Given my client has a problem
And context I don’t know about
When I suggest a practice to help
Then they’ll think I’m an idiot.
Failure Scenarios
Given Fred has signed up for Appytastic
When we sync to Facebook by default
Then Fred and Fred’s friends
might see that Appytastic has
massive privacy issues.
A way of knowing it’s succeeding
My client delivers software.
Fred’s friends see how awesome
Appytastic is (and sign up).
Success Metrics!
Software is delivered –
how quickly?
Sign-up rate increases –
how much does it increase by?
A way of knowing it’s failing
My client thinks I’m an idiot.
Fred and Fred’s friends
might see that Appytastic has
massive privacy issues.
Failure metrics!
Frowning faces!
(but you get what you measure,
so measure smiles)
Sign-up rate decreases;
proportion of positive tweets decreases
What if a meteor
hits our data centre?
A Safe-To-Fail Probe has…
A way of knowing it’s succeeding
A way of knowing it’s failing
A way of dampening it
A way of amplifying it
Coherence
A way of avoiding failure completely
Success is guaranteed…
…when you’ve done it before
…in the same context
…with the same requirements
…and the same people
…and the same technology
…and the same market
…and you own a time machine.
Make it cheap to fail.
Given my client has a problem
And context I don’t know about
When I suggest a practice to help
Then they’ll think I’m an idiot.
(Tell them it’s a way of
getting context quickly.)
Make it cheap to fail
Given Fred has signed up for Appytastic
When we sync to Facebook by default
Then Fred and Fred’s friends
might see that Appytastic has
massive privacy issues!
(Put the flag on the server.)
Estimating Complexity
5. Nobody has ever done it before
4. Someone outside the org has done it before
(probably a competitor)
3. Someone in the company has done it before
2. Someone in the team has done it before
1. We all know how to do it.
Estimating Complexity
5 4 3
2
1
ComplicatedComplex
Obvious
Familiarity
5 4 3
2
1
Experts familiar
with scenariosUnfamiliar
scenarios
Familiar
scenarios
Disaster
movies!
Context Questioning
Is there a context which,
for some event,
will give us more
options?
Context Questioning
Is there a context which,
for some event,
will give outcomes that are
cheaper to change?
Warning!
Be careful when you’re
opening up options
that you’re not
signalling intent
The Shallow Dive into Chaos
Scenarios
Anchor the behaviour you value.
In unfamiliar scenarios, create options –
make it safe-to-fail.
Change code;
help people change themselves.
Some experiments
should fail.
TDD All the Things!

More Related Content

PPTX
Bdd for Life
PPTX
Behavior Driven Development
PDF
Bdd: a bit of an experiment
PPTX
Organic, not chaotic
PPTX
Retrospectives
PDF
How to test the inside of your head
PPTX
The feedback workshop
PPTX
The 100k proposition
Bdd for Life
Behavior Driven Development
Bdd: a bit of an experiment
Organic, not chaotic
Retrospectives
How to test the inside of your head
The feedback workshop
The 100k proposition

Viewers also liked (11)

PPTX
Keeping your company a*hole-free
PDF
Agile Software Development with Remote Teams
ODP
Assholes are Killing your Project (Monktoberfest)
PPTX
Agile101
PPTX
BDD presentation
PDF
Become Software Tester or Developer
PDF
Test and Behaviour Driven Development (TDD/BDD)
PDF
Behavior Driven Development and Automation Testing Using Cucumber
PDF
Behavior Driven Development with Cucumber
ODP
Assholes are killing your project
PDF
BDD in Action - building software that matters
Keeping your company a*hole-free
Agile Software Development with Remote Teams
Assholes are Killing your Project (Monktoberfest)
Agile101
BDD presentation
Become Software Tester or Developer
Test and Behaviour Driven Development (TDD/BDD)
Behavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development with Cucumber
Assholes are killing your project
BDD in Action - building software that matters
Ad

Similar to TDD All the Things! (20)

PDF
What CS Class Didn't Teach About Testing
PDF
Experiment Driven Product Innovation
PPTX
From good to great product ownership
PDF
Learn Learning + Prototype Testing
PDF
Top 5 Reasons Why Improvement Efforts Fail
KEY
Acceptance testfurureinmind
PDF
To Estimate or Not to Estimate, is that the Question?
PPTX
Testing within an Agile Environment - Beyza Sakir and Chris Gollop
KEY
Essential practices and thinking tools for Agile Adoption
PPTX
Reviewing a Developer Experience
PDF
The Automation Firehose: Be Strategic and Tactical by Thomas Haver
PDF
Being a Data-Driven Communicator
PDF
Lean Startup Machine Napoli Experiment Board
PPTX
Startup Failure Is Not What You Think It Is - Deep Dive.pptx
PPTX
Richard Wilburn - Lean Truth
PDF
Pragmatic notdogmatictdd agile2012
PDF
Pragmatic Not Dogmatic TDD Agile2012 by Joseph Yoder and Rebecca Wirfs-Brock
PDF
Try: Fail, Try: Succeed by Tim Grant
PDF
UXSG2014 Workshop (Day 1) - Lean Startup (Bryan Long)
PDF
Testing in a Continuous World
What CS Class Didn't Teach About Testing
Experiment Driven Product Innovation
From good to great product ownership
Learn Learning + Prototype Testing
Top 5 Reasons Why Improvement Efforts Fail
Acceptance testfurureinmind
To Estimate or Not to Estimate, is that the Question?
Testing within an Agile Environment - Beyza Sakir and Chris Gollop
Essential practices and thinking tools for Agile Adoption
Reviewing a Developer Experience
The Automation Firehose: Be Strategic and Tactical by Thomas Haver
Being a Data-Driven Communicator
Lean Startup Machine Napoli Experiment Board
Startup Failure Is Not What You Think It Is - Deep Dive.pptx
Richard Wilburn - Lean Truth
Pragmatic notdogmatictdd agile2012
Pragmatic Not Dogmatic TDD Agile2012 by Joseph Yoder and Rebecca Wirfs-Brock
Try: Fail, Try: Succeed by Tim Grant
UXSG2014 Workshop (Day 1) - Lean Startup (Bryan Long)
Testing in a Continuous World
Ad

Recently uploaded (20)

PPT
risk management (contd.) Risk Identification Risk Components and Drivers Risk...
PDF
The Pearson Complete Course for CISM Certification: Unit 1
PPT
Software EffortEstimation and Risk Project Planning Activities Software Scope...
PPTX
Time Management Techniques_All Rules.pptx
PPTX
SM_Behavior Based Safety (BBS)_Unit V.pptx
PDF
The Pearson Complete Course for CISM Certification: Unit 2
PPTX
Management and Leadership across diverse culture
PPTX
Common Methods of Performance Appraisal.pptx
PPTX
Management and Leadership across culture at McDonald's
PPT
development_theories chapter 3.ppt undfer
PDF
The Psychology of Employee Appreciation by Meenakshi Khakat
PDF
SpatzAI Micro-Conflict Resolution Toolkit - Fairer Teamwork Globally
PPTX
International trading agreements in world.pptx
PPTX
Unit 6: Product service and brand.pptx mm
DOC
TAMUK毕业证学历认证,北科罗拉多大学毕业证文凭
PDF
The ANC Youth League: Navigating the Next Generation Struggle and Strategy by...
PPT
Risk Management What is Risk Management Risk Management Strategies Software R...
PPTX
The Impact of Hofstede’s 6D Model on Emotional Intelligence in Global Teams.pptx
PPTX
3 Information Systems and AI in Change Management.pptx
PPTX
management development and careerr planning.pptx
risk management (contd.) Risk Identification Risk Components and Drivers Risk...
The Pearson Complete Course for CISM Certification: Unit 1
Software EffortEstimation and Risk Project Planning Activities Software Scope...
Time Management Techniques_All Rules.pptx
SM_Behavior Based Safety (BBS)_Unit V.pptx
The Pearson Complete Course for CISM Certification: Unit 2
Management and Leadership across diverse culture
Common Methods of Performance Appraisal.pptx
Management and Leadership across culture at McDonald's
development_theories chapter 3.ppt undfer
The Psychology of Employee Appreciation by Meenakshi Khakat
SpatzAI Micro-Conflict Resolution Toolkit - Fairer Teamwork Globally
International trading agreements in world.pptx
Unit 6: Product service and brand.pptx mm
TAMUK毕业证学历认证,北科罗拉多大学毕业证文凭
The ANC Youth League: Navigating the Next Generation Struggle and Strategy by...
Risk Management What is Risk Management Risk Management Strategies Software R...
The Impact of Hofstede’s 6D Model on Emotional Intelligence in Global Teams.pptx
3 Information Systems and AI in Change Management.pptx
management development and careerr planning.pptx

TDD All the Things!