SlideShare a Scribd company logo
Navigating the xDD Alphabet Soup
http://blog.drorhelper.com
A history lesson Methodologies
Books! Books!
Books!
Tools overview
Navigating the xDD Alphabet Soup
Navigating the xDD Alphabet Soup
little a few flaws
lot many more flaws
feature works
customer's requirements
1991 1994 1997 2000 2002
Taligent
framework
NUnit 2.0Kent Beck
writes first
version of
SUnit test
framework*
Kent Beck &
Erich Gamma
create JUnit
During a flight
to OOPSLA
Michael
Features
ports JUnit to
C++ (CppUnit)
Test Suite
Fixture
Test Case
Test Case
Test Case
Test Case
Test Case
Fixture
Test Case
Test Case
Fixture
Test Case
Test Case
Test Case
public class BeforeAndAfter {
@Before
public void setUp() {
}
@After
public void tearDown() {
}
@Test
public void test1() {
}
@Test
public void test2() {
}
}
method
specific functionality,
clear pass/fail
runs in isolation
feedback
stupid
regression
without fear
documentation
Navigating the xDD Alphabet Soup
Red
Green
Refactor
is not
@Test
public void Pass1_ReturnI() {
cut = new ArabicToRoman();
}
@Test
public void Pass1_ReturnI() {
cut = new ArabicToRoman();
}
public class ArabicToRoman {
}
@Test
public void Pass1_ReturnI() {
cut = new ArabicToRoman();
String result = cut.convert(1);
assertEquals("I", result);
}
public class ArabicToRoman {
}
@Test
public void Pass1_ReturnI() {
cut = new ArabicToRoman();
String result = cut.convert(1);
assertEquals("I", result);
}
public class ArabicToRoman {
public String convert(int num) {
return null;
}
}
@Test
public void Pass1_ReturnI() {
cut = new ArabicToRoman();
String result = cut.convert(1);
assertEquals("I", result);
}
public class ArabicToRoman {
public String convert(int num) {
return null;
}
}
@Test
public void Pass1_ReturnI() {
cut = new ArabicToRoman();
String result = cut.convert(1);
assertEquals("I", result);
}
public class ArabicToRoman {
public String convert(int num) {
return “I”;
}
}
@Test
public void Pass1_ReturnI() {
cut = new ArabicToRoman();
String result = cut.convert(1);
assertEquals("I", result);
}
public class ArabicToRoman {
public String convert(int num) {
return “I”;
}
}
@Test
public void Pass1_ReturnI() {
cut = new ArabicToRoman();
String result = cut.convert(1);
assertEquals("I", result);
}
@Test
public void Pass2_ReturnII() {
cut = new ArabicToRoman();
String result = cut.convert(2);
assertEquals("II", result);
}
public class ArabicToRoman {
public String convert(int num) {
return “I”;
}
}
@Test
public void Pass1_ReturnI() {
cut = new ArabicToRoman();
String result = cut.convert(1);
assertEquals("I", result);
}
@Test
public void Pass2_ReturnII() {
cut = new ArabicToRoman();
String result = cut.convert(2);
assertEquals("II", result);
}
public class ArabicToRoman {
public String convert(int num) {
return “I”;
}
}
@Test
public void Pass1_ReturnI() {
cut = new ArabicToRoman();
String result = cut.convert(1);
assertEquals("I", result);
}
@Test
public void Pass2_ReturnII() {
cut = new ArabicToRoman();
String result = cut.convert(2);
assertEquals("II", result);
}
public class ArabicToRoman {
public String convert(int num) {
if(i == 2)
return "II";
return "I";
}
}
@Test
public void Pass1_ReturnI() {
cut = new ArabicToRoman();
String result = cut.convert(1);
assertEquals("I", result);
}
@Test
public void Pass2_ReturnII() {
cut = new ArabicToRoman();
String result = cut.convert(2);
assertEquals("II", result);
}
public class ArabicToRoman {
public String convert(int num) {
if(i == 2)
return "II";
return "I";
}
}
@Test
public void Pass1_ReturnI() {
cut = new ArabicToRoman();
String result = cut.convert(1);
assertEquals("I", result);
}
@Test
public void Pass2_ReturnII() {
cut = new ArabicToRoman();
String result = cut.convert(2);
assertEquals("II", result);
}
public class ArabicToRoman {
public String convert(int num) {
result = new StringBuilder();
for(int i = 0 ; i < num ; i++)
{
result.append("I");
}
return result.toString();
}
}
Navigating the xDD Alphabet Soup
Navigating the xDD Alphabet Soup
S.Else Server
Call
CommClient Phone
RingMessage
OnCallRequested
AmazingUIAmazing UI
S Calling U
Accept Call
ConnectToServer
ConnectMessage
Navigating the xDD Alphabet Soup
Server Comm Client UITestFake Comm
Navigating the xDD Alphabet Soup
Navigating the xDD Alphabet Soup
Navigating the xDD Alphabet Soup
Navigating the xDD Alphabet Soup
“
”
implementing
what you think the users want
Navigating the xDD Alphabet Soup
1996 2002 2002 2003
Automated tests
are part of Extreme
Programming.
Ward Cunningham
publishes Fit
Bob Martin
combines Fit with
Wikis tocreate
Fitnesse
Kent Beck briefly
mentions ATDD in
“TDD: By Example”
but dismisses it as
impractical
user story
development team implementation phase.
Navigating the xDD Alphabet Soup
Unit tests Acceptance tests
Fast Slow
No side effects Side effects
Simple to run Dependent on environment
Test single “unit of work” Test single scenario/feature
Written by developers Written by customers
Verify that code works Overall system works as required
Test must pass before check-in Test may only pass when feature is
done
Fake other units Fake other systems
Navigating the xDD Alphabet Soup
numerator Denominator quotient?
10 2 5.0
12.6 3 4.2
100 4 33
org/FitNesse.FullReferenceGuide.UserGuide.WritingAcceptanceTests.FixtureCode
public class Division {
private double numerator,
denominator;
public void setNumerator(double
numerator) {
this.numerator = numerator;
}
public void setDenominator(double
denominator) {
this.denominator = denominator;
}
public double quotient() {
return numerator/denominator;
}
}
Navigating the xDD Alphabet Soup
Red
Green
Refactor
Red
Green
Refactor Red
Green
RefactorRed
Green
Refactor
Red
Green
Refactor Red
Green
Refactor
Red
Green
Refactor
Discuss
DistillDevelop
Demo
ed.com/wp-content/uploads/2011/04/atddexample.pdf
Story
item
Red
Green
Refactor
TDD
Navigating the xDD Alphabet Soup
“
”
Specifications are supposed to be general
Examples only highlight a few points
http://martinfowler.com/bliki/SpecificationByExample.html
/drawings/d/1cbfKq-KazcbMVCnRfih6zMSDBdtf90KviV7l2oxGyWM/edit?hl=en
Business goal/desired effect
Scope
Key Examples
Specification with Examples
Executable Specification
Living Documentation
Derive the scope from goals
Specify collaboratively
Refine the specification
Validate frequently
Automate literally
Navigating the xDD Alphabet Soup
Navigating the xDD Alphabet Soup
Navigating the xDD Alphabet Soup
Sensors PLC ModelClient
Business
logic
Raw data
Converted
data
command
Navigating the xDD Alphabet Soup
less of a wax-on, wax-off process of
gradual mastery than a series of blind alleys…
presentTDD in a way
that gets straight to the good stuff and avoids all the
pitfalls.
public class CustomerLookupTest extendsTestCase {
testFindsCustomerById() {
}
testFailsForDuplicateCustomers() {
}
}
× Test123
× CustomerTest
× PerchaseOrderTestNew
× MoveBatteryVanilla
 CalculateTax_InvalidYear_LogErrorToFile
 OrdersShouldBeCreated
 OrdersWithNoProductsShouldFail
“
”
comprehensively
describe the behaviour of your system
“Behaviour” is a more useful word than “test”
Navigating the xDD Alphabet Soup
Steps
Scenarios
Story
In Order to…
As a…
I want to…
Scenario 1
Given When Then
Scenario 2
Given When Then
public class TraderSteps{
private TradingService service;
private Stock stock;
@Given("a stock and a threshold of $threshold")
public void aStock(double threshold) {
stock = service.newStock("STK", threshold);
}
@When("the stock is traded at price $price")
public void theStockIsTraded(double price){
stock.tradeAt(price);
}
@Then("the alert status is $status")
public void theAlertStatusIs($status){
assertThat(stock.getStatus().Name(), equalTo(status));
}
}
Scenario: A trader is alerted of status
Given a stock and a threshold of 15.0
When stock is traded at 5.0
Then the alert status should be off
Feature: Addition
In order to avoid silly mistakes
As a math idiot
I want to be told the sum of two numbers
Scenario: Add two numbers
Given I have entered 50 into the calculator
And I have entered 70 into the calculator
When I press add
Then the result should be 120 on the screen
From: https://cukes.info/
describe Stack do
it "should return a blank instance" do
Stack.new.should == {}
end
it "element is added to the stack on top of the stack" do
stack = Stack.new
stack.push 'a value'
stack.pop.should == 'a value'
end
end
Stack
should return a blank instance
element is added to the stack on top of the stack
Navigating the xDD Alphabet Soup
[Test]
public void OutOfStorageWhileCreatingFileAndExactFilesToMakeRoom()
{
var fakeSystemInfo = A.Fake<ISystemInfo>();
A.CallTo(() => fakeSystemInfo.GetFreeDiskSpaceInBytes()).Returns(0);
var logfiles = new[]
{
new LogFile
{
Name = "file-1.log",
Size = 50000
},
new LogFile
{
Name = "file-2.log",
Size = 50000
}
};
var fakeLogFolder = A.Fake<ISharedStorageFolder>();
A.CallTo(() => fakeLogFolder.GetFiles()).Returns(logfiles);
var logFileWriter = new LogFileWriter(fakeSystemInfo, fakeLogFolder);
logFileWriter.Write("some message");
A.CallTo(() => fakeLogFolder.DeleteFile("file-1.log")).MustHaveHappened();
A.CallTo(() => fakeLogFolder.DeleteFile("file-2.log")).MustHaveHappened();
}
SCENARIO("First roll is strike")
{
GIVEN("Bowled strike on first turn")
{
Game game;
game.Roll(10);
WHEN("Next roll is spare then roll five")
{
game.Roll(3);
game.Roll(7);
game.Roll(5);
RollSeveral(game, 15, 0);
THEN("Total score is 40")
{
REQUIRE(game.Score() == 40);
}
}
WHEN("Next two rolls are strike then gutter balls")
{
game.Roll(10);
game.Roll(10);
RollSeveral(game, 16, 0);
THEN("Total score is 60")
{
REQUIRE(game.Score() == 60);
}
}
}
}
Navigating the xDD Alphabet Soup
TDD
Classic
London
ATDD
SbE
BDD
Stories
Specification
Choose 2
“
”http://lizkeogh.com/2011/03/04/step-away-from-the-tools/
http://geek-and-poke.com/geekandpoke/2013/6/6/dont-ask-your-boss
“
”http://blog.mattwynne.net/2012/11/20/tdd-vs-bdd/
They're just both useful to have in your back
pocket as you go around trying to write decent
software to solve useful problems.
But I bet
that's what Kent Beck would say if you asked him
whatTDD was all about.
Dan North, DefiningTDD,
https://groups.google.com/forum/#!msg/behaviordrivendevelopment/OQnb3APpUJk/RklRiyEKde4J
Thank you
drorh@codevalue.net
http://blog.drorhelper.com

More Related Content

PDF
Introduction to web programming for java and c# programmers by @drpicox
PDF
Pyconie 2012
PPTX
SoCal Code Camp 2015: An introduction to Java 8
DOCX
.net progrmming part1
PDF
The Ring programming language version 1.6 book - Part 184 of 189
PDF
TDD CrashCourse Part3: TDD Techniques
ODP
Klee introduction
Introduction to web programming for java and c# programmers by @drpicox
Pyconie 2012
SoCal Code Camp 2015: An introduction to Java 8
.net progrmming part1
The Ring programming language version 1.6 book - Part 184 of 189
TDD CrashCourse Part3: TDD Techniques
Klee introduction

What's hot (20)

PPTX
Symbolic Execution And KLEE
PPT
Introduzione al TDD
PDF
Concurrency Concepts in Java
PDF
關於測試,我說的其實是......
PDF
(automatic) Testing: from business to university and back
PDF
TDD Hands-on
PDF
Automatically Describing Program Structure and Behavior (PhD Defense)
PDF
Example First / A Sane Test-Driven Approach to Programming
PPTX
Tools and Techniques for Understanding Threading Behavior in Android*
PDF
Golang dot-testing-lite
PPT
Swiss army knife Spring
PDF
GMock framework
PDF
Agile Android
PPT
Verilog Lecture4 2014
PPT
PDF
Software Testing - Invited Lecture at UNSW Sydney
PPTX
Migrating to JUnit 5
PDF
PVS-Studio in 2021 - Error Examples
PDF
Agile mobile
PPTX
How Data Flow analysis works in a static code analyzer
Symbolic Execution And KLEE
Introduzione al TDD
Concurrency Concepts in Java
關於測試,我說的其實是......
(automatic) Testing: from business to university and back
TDD Hands-on
Automatically Describing Program Structure and Behavior (PhD Defense)
Example First / A Sane Test-Driven Approach to Programming
Tools and Techniques for Understanding Threading Behavior in Android*
Golang dot-testing-lite
Swiss army knife Spring
GMock framework
Agile Android
Verilog Lecture4 2014
Software Testing - Invited Lecture at UNSW Sydney
Migrating to JUnit 5
PVS-Studio in 2021 - Error Examples
Agile mobile
How Data Flow analysis works in a static code analyzer
Ad

Similar to Navigating the xDD Alphabet Soup (20)

PDF
Confitura 2012 Bad Tests, Good Tests
PDF
GeeCON 2012 Bad Tests, Good Tests
PPTX
PDF
Unit Testing Standards - Recommended Best Practices
DOCX
Junit With Eclipse
PPTX
Tdd guide
PPTX
Test driven development
PDF
Code Kata: String Calculator in Flex
PDF
TDD step patterns
PPTX
Introduction to JUnit
PDF
An introduction to property based testing
PPTX
BDD Primer
PPTX
Writing Good Tests
KEY
An introduction to mutation testing
PPTX
Building unit tests correctly with visual studio 2013
PPTX
Building unit tests correctly
PPTX
Tieto tdd from-dreams_to_reality_s.narkevicius_v.pozdniakov_2013 (1)
PPTX
Unit Testing with Foq
KEY
Tdd for BT E2E test community
PDF
Operator Overloading In Scala
Confitura 2012 Bad Tests, Good Tests
GeeCON 2012 Bad Tests, Good Tests
Unit Testing Standards - Recommended Best Practices
Junit With Eclipse
Tdd guide
Test driven development
Code Kata: String Calculator in Flex
TDD step patterns
Introduction to JUnit
An introduction to property based testing
BDD Primer
Writing Good Tests
An introduction to mutation testing
Building unit tests correctly with visual studio 2013
Building unit tests correctly
Tieto tdd from-dreams_to_reality_s.narkevicius_v.pozdniakov_2013 (1)
Unit Testing with Foq
Tdd for BT E2E test community
Operator Overloading In Scala
Ad

More from Dror Helper (20)

PPTX
Unit testing patterns for concurrent code
PPTX
The secret unit testing tools no one ever told you about
PPTX
Debugging with visual studio beyond 'F5'
PPTX
From clever code to better code
PPTX
From clever code to better code
PPTX
A software developer guide to working with aws
PPTX
The secret unit testing tools no one has ever told you about
PPTX
The role of the architect in agile
PDF
Harnessing the power of aws using dot net core
PPTX
Developing multi-platform microservices using .NET core
PPTX
Harnessing the power of aws using dot net
PPTX
Secret unit testing tools no one ever told you about
PPTX
C++ Unit testing - the good, the bad & the ugly
PPTX
Working with c++ legacy code
PPTX
Visual Studio tricks every dot net developer should know
PPTX
Secret unit testing tools
PPTX
Electronics 101 for software developers
PPTX
Who’s afraid of WinDbg
PPTX
Unit testing patterns for concurrent code
PPTX
Designing with tests
Unit testing patterns for concurrent code
The secret unit testing tools no one ever told you about
Debugging with visual studio beyond 'F5'
From clever code to better code
From clever code to better code
A software developer guide to working with aws
The secret unit testing tools no one has ever told you about
The role of the architect in agile
Harnessing the power of aws using dot net core
Developing multi-platform microservices using .NET core
Harnessing the power of aws using dot net
Secret unit testing tools no one ever told you about
C++ Unit testing - the good, the bad & the ugly
Working with c++ legacy code
Visual Studio tricks every dot net developer should know
Secret unit testing tools
Electronics 101 for software developers
Who’s afraid of WinDbg
Unit testing patterns for concurrent code
Designing with tests

Recently uploaded (20)

PPTX
MYSQL Presentation for SQL database connectivity
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Big Data Technologies - Introduction.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Spectroscopy.pptx food analysis technology
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Electronic commerce courselecture one. Pdf
PDF
cuic standard and advanced reporting.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Machine learning based COVID-19 study performance prediction
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
MYSQL Presentation for SQL database connectivity
“AI and Expert System Decision Support & Business Intelligence Systems”
The Rise and Fall of 3GPP – Time for a Sabbatical?
Big Data Technologies - Introduction.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
sap open course for s4hana steps from ECC to s4
Spectroscopy.pptx food analysis technology
Chapter 3 Spatial Domain Image Processing.pdf
Review of recent advances in non-invasive hemoglobin estimation
Electronic commerce courselecture one. Pdf
cuic standard and advanced reporting.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Programs and apps: productivity, graphics, security and other tools
Digital-Transformation-Roadmap-for-Companies.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Understanding_Digital_Forensics_Presentation.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Encapsulation_ Review paper, used for researhc scholars
Machine learning based COVID-19 study performance prediction
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...

Navigating the xDD Alphabet Soup

Editor's Notes

  • #9: Setup Execution Validation Cleanup
  • #12: Never write a single line of code unless you have a failing automated test. Eliminate duplication.
  • #59: BDD is essentially Test Domain Driven Design
  • #61: Business readable + writable Similar to what ATDD had to offer  closer to developers
  • #63:  2005 as an experiment by Steven Baker, with early contributions from Dave Astels and Aslak Hellesøy.  RSpec 1.0 was released in May of 2007 Rspec 3 was released in June 2014
  • #66: Need actual example
  • #73: So what are those good habits? Specifically, I think those good habits are: Working outside-in, starting from a business or organisational goal Using examples to clarify requirements Developing and using a ubiquitous language