SlideShare une entreprise Scribd logo
1  sur  88
Test-driven
development
    Kerry Buckley
    26 July 2012
Who the hell are you?
What is TDD?
Test-driven development
From Wikipedia, the free encyclopedia

Test-driven development (TDD) is a software
development process that relies on the repetition
of a very short development cycle: first the
developer writes a failing automated test case that
defines a desired improvement or new function,
then produces code to pass that test and finally
refactors the new code to acceptable standards.
Terms
Terms

• Unit testing
Terms

• Unit testing
• Integration testing
Terms

• Unit testing
• Integration testing
• Acceptance testing
Towards TDD
         0. manual testing




         Write
Design              Test     Release
         code
Towards TDD
            1. automated testing




         Write     Write
Design                        Test   Release
         code      tests
Towards TDD
          2. test-first development




         Write     Write
Design                        Test   Release
         tests     code
Towards TDD
           3. test-driven development

Design
   Write        Run            Write
   test         test           code
                                        Release
                        Run
         Refactor
                       tests
Towards TDD
3. test-driven development



 Red                Green




         Refactor
Beyond TDD?
      4. behaviour-driven development


                   Executable
Customer                                Release
                    examples




             Red                Green

                     TDD

                    Refactor
Unit test tools
Unit test tools
• Java: JUnit, TestNG…
Unit test tools
• Java: JUnit, TestNG…
• C#: NUnit, csUnit…
Unit test tools
• Java: JUnit, TestNG…
• C#: NUnit, csUnit…
• Ruby: Test::Unit, MiniTest, RSpec…
Unit test tools
• Java: JUnit, TestNG…
• C#: NUnit, csUnit…
• Ruby: Test::Unit, MiniTest, RSpec…
• Javascript: JSUnit, JSSpec, Jasmine…
Unit test tools
• Java: JUnit, TestNG…
• C#: NUnit, csUnit…
• Ruby: Test::Unit, MiniTest, RSpec…
• Javascript: JSUnit, JSSpec, Jasmine…
• and many more
Acceptance test tools
Acceptance test tools
• Fit/Fitnesse
Acceptance test tools
• Fit/Fitnesse
• Exactor
Acceptance test tools
• Fit/Fitnesse
• Exactor
• Selenium
Acceptance test tools
• Fit/Fitnesse
• Exactor
• Selenium
• Cucumber
Acceptance test tools
• Fit/Fitnesse
• Exactor
• Selenium
• Cucumber
• Windmill
Acceptance test tools
• Fit/Fitnesse
• Exactor
• Selenium
• Cucumber
• Windmill
• etc
Anatomy of a test
           # Given some test accounts
➊ Setup    account_1 = Account.new(100)
           account_2 = Account.new(50)

           # When I transfer money
➋ Act      transfer(20, from: account_1,
                          to: account_2)

           # Then the balances should be updated
➌ Assert   account_1.balance.should eq(80)
           account_2.balance.should eq(70)
Acceptance tests
   Example using Cucumber
Acceptance tests

Feature: Logging in and out

  Scenario: User is greeted on login
    Given the user "Kerry" has an account
    When he logs in
    Then he should see "Welcome, Kerry"
Acceptance tests
$ cucumber login.feature
Feature: Logging in and out
Scenario: User is greeted on login
Given the user "Kerry" has an account
When he logs in
Then he should see "Welcome, Kerry"
1 scenario (1 undefined) 3 steps (3 undefined) 0m0.002s
# login.feature:3 # login.feature:4 # login.feature:5 # login.feature:6
You can implement step definitions for undefined steps with
Given /^the user "(.*?)" has an account$/ do |arg1|
  pending # express the regexp above with the code you wish
end
...
Acceptance tests
Given /^the user "(.*?)" has an account$/ do |username|
  @user = User.create username: username, password: secret
end

When /^he logs in$/ do
  visit "/login"
  fill_in "User name", :with => @user.username
  fill_in "Password", :with => "secret"
  click_button "Log in"
end

Then /^he should see "(.*?)"$/ do |text|
  page.should have_text(text)
end
Acceptance tests
$ cucumber login.feature
Feature: Logging in and out
Scenario: User is greeted on login
Given the user "Kerry" has an account # steps.rb:24
When he logs in # steps.rb:28
Then he should see "Welcome, Kerry" # steps.rb:35
  expected there to be content "Log out" in "Welcome to the site!nThere's
nothing here yet.” (RSpec::Expectations::ExpectationNotMetError)
  ./steps.rb:36:in `/^he should see "(.*?)"$/'
  login.feature:6:in `Then he should see "Welcome, Kerry"'
Failing Scenarios:
cucumber login.feature:3 # Scenario: User is greeted on login
1 scenario (1 failed)
3 steps (1 failed, 2 passed) 0m0.002s
Acceptance tests

$ cucumber login.feature
Feature: Logging in and out
Scenario: User is greeted on login
Given the user "Kerry" has an account # steps.rb:24
When he logs in # steps.rb:28
Then he should see "Welcome, Kerry" # steps.rb:35
1 scenario (1 passed) 3 steps (3 passed) 0m0.003s
Unit tests
Example using RSpec
Unit tests

describe Calculator do
  it "can add two numbers" do
    calculator = Calculator.new
    calculator.add(2, 3).should eq("   5")
  end
end
Unit tests


$ rspec calculator_spec.rb
calculator_spec.rb:1:in `<top (required)>':
uninitialized constant Calculator (NameError)
Unit tests


class Calculator
end
Unit tests
$ rspec calculator_spec.rb
F
Failures:
1) Calculator can add two numbers
Failure/Error: calculator.add(2, 3).should eq(5)
  NoMethodError:
  undefined method `add' for #<Calculator:0x007fa0ac1ea718>
# ./calculator_spec.rb:6:in `block (2 levels) in <top (required)>'
Finished in 0.00035 seconds
1 example, 1 failure
Failed examples:
rspec ./calculator_spec.rb:4 # Calculator can add two numbers
Unit tests


class Calculator
  def add
  end
end
Unit tests
$ rspec calculator_spec.rb
F
Failures:
  1) Calculator can add two numbers
    Failure/Error: calculator.add(2, 3).should eq(" 5")
    ArgumentError: wrong number of arguments (2 for 0)
    #  ./calculator.rb:2:in `add'
    #  ./calculator_spec.rb:6:in `block (2 levels) in <top (required)>'
Finished in 0.0005 seconds
1 example, 1 failure
Failed examples:
rspec ./calculator_spec.rb:4 # Calculator can add two numbers
Unit tests


class Calculator
  def add a, b
  end
end
Unit tests
$ rspec calculator_spec.rb
F
Failures:
  1) Calculator can add two numbers
    Failure/Error: calculator.add(2, 3).should eq("       5")
      expected: "       5"
           got: nil
      (compared using ==)
    # ./calculator_spec.rb:6:in `block (2 levels) in <top (required)>'
Finished in 0.00066 seconds
1 example, 1 failure
Failed examples:
rspec ./calculator_spec.rb:4 # Calculator can add two numbers
Unit tests

class Calculator
  def add a, b
    "       #{a + b}"
  end
end
Unit tests


$ rspec calculator_spec.rb
.
Finished in 0.00065 seconds
1 example, 0 failures
Unit tests
describe Calculator do
  it "can add two numbers" do
    calculator = Calculator.new
    calculator.add(2, 3).should eq("       5")
  end

  it "pads output to eight characters" do
    calculator = Calculator.new
    calculator.add(2, 2).should eq("       4")
    calculator.add(5, 5).should eq("      10")
  end
end
Unit tests
$ rspec calculator_spec.rb
.F
Failures:
     1) Calculator pads output to eight characters
     Failure/Error: calculator.add(5, 5).should eq(" 10")
      expected: "       10"
           got: "        10"
      (compared using ==)
     # ./calculator_spec.rb:12:in `block (2 levels) in <top (required)>'
Finished in 0.00086 seconds
2 examples, 1 failure
Failed examples:
rspec ./calculator_spec.rb:9 # Calculator pads output to eight characters
Unit tests

class Calculator
  def add a, b
    "%8i" % (a + b)
  end
end
Unit tests


$ rspec calculator_spec.rb
..

Finished in 0.00076 seconds

2 examples, 0 failures
Unit tests
describe Calculator do
  it "can add two numbers" do
    calculator = Calculator.new
    calculator.add(2, 3).should eq("       5")
  end

  it "pads output to eight characters" do
    calculator = Calculator.new
    calculator.add(2, 2).should eq("       4")
    calculator.add(5, 5).should eq("      10")
  end
end
Unit tests
describe Calculator do
  before do
    @calculator = Calculator.new
  end

  it "can add two numbers" do
    @calculator.add(2, 3).should eq("        5")
  end

  it "pads output to eight characters" do
    @calculator.add(2, 2).should eq("        4")
    @calculator.add(5, 5).should eq("       10")
  end
end
Unit tests


$ rspec calculator_spec.rb
..
Finished in 0.00075 seconds
2 examples, 0 failures
Unit tests
describe Calculator do
  before do
    @calculator = Calculator.new
  end

  it "can add two numbers" do
    @calculator.add(2, 3).should eq("         5")
  end

  it "can subtract two numbers" do
    @calculator.subtract(3, 1).should eq("          2")
  end

  it "pads output to eight characters" do
    @calculator.add(2, 2).should eq("         4")
    @calculator.add(5, 5).should eq("        10")
  end
end
Unit tests

class Calculator
  def add a, b
    "%8i" % (a + b)
  end

  def subtract a, b
    "%8i" % (a - b)
  end
end
Unit tests


$ rspec calculator_spec.rb
...
Finished in 0.00085 seconds
3 examples, 0 failures
Unit tests

class Calculator
  def add a, b
    "%8i" % (a + b)
  end

  def subtract a, b
    "%8i" % (a - b)
  end
end
Unit tests
class Calculator
  def add a, b
    format(a + b)
  end

  def subtract a, b
    format(a - b)
  end

  private

  def format number
    "%8i" % number
  end
end
Unit tests


$ rspec calculator_spec.rb
...
Finished in 0.00086 seconds
3 examples, 0 failures
Unit tests
describe Calculator do
  before do
    @calculator = Calculator.new
  end

  it "can add two numbers" do
    @calculator.add(2, 3).should eq("        5")
  end

  it "pads output to eight characters" do
    @calculator.add(2, 2).should eq("        4")
    @calculator.add(5, 5).should eq("       10")
  end
end
Unit tests

$ rspec --format doc calculator_spec.rb
Calculator
  can add two numbers
  can subtract two numbers
  pads output to eight characters
Finished in 0.00094 seconds
3 examples, 0 failures
A good test suite…
A good test suite…
• Expresses the programmer’s intent
A good test suite…
• Expresses the programmer’s intent
• Gives confidence that the system works
A good test suite…
• Expresses the programmer’s intent
• Gives confidence that the system works
• Runs quickly
A good test suite…
• Expresses the programmer’s intent
• Gives confidence that the system works
• Runs quickly
• Gives clear failure messages
A good test suite…
• Expresses the programmer’s intent
• Gives confidence that the system works
• Runs quickly
• Gives clear failure messages
• Is well-maintained
A good test suite…
• Expresses the programmer’s intent
• Gives confidence that the system works
• Runs quickly
• Gives clear failure messages
• Is well-maintained
• Isolates each area under test
Benefits of TDD
Benefits of TDD
• Less manual testing required
Benefits of TDD
• Less manual testing required
• Faster feedback
Benefits of TDD
• Less manual testing required
• Faster feedback
• Safety net to make changes safer
Benefits of TDD
• Less manual testing required
• Faster feedback
• Safety net to make changes safer
• Shorter cycle time
Benefits of TDD
• Less manual testing required
• Faster feedback
• Safety net to make changes safer
• Shorter cycle time
• Reduced rework
Benefits of TDD
• Less manual testing required
• Faster feedback
• Safety net to make changes safer
• Shorter cycle time
• Reduced rework
• Improved design
What about testers?
What about testers?

• Less tedious repetitive manual testing
What about testers?

• Less tedious repetitive manual testing
• Concentrate on exploratory testing
What about testers?

• Less tedious repetitive manual testing
• Concentrate on exploratory testing
• Identify edge cases and ‘sad path’ tests
What about testers?

• Less tedious repetitive manual testing
• Concentrate on exploratory testing
• Identify edge cases and ‘sad path’ tests
• Help define acceptance tests
How do I start?
How do I start?
• Greenfield project? JFDI! Otherwise…
How do I start?
• Greenfield project? JFDI! Otherwise…
• Automate highest value tests first
How do I start?
• Greenfield project? JFDI! Otherwise…
• Automate highest value tests first
  • Important features
How do I start?
• Greenfield project? JFDI! Otherwise…
• Automate highest value tests first
  • Important features
  • Where the most bugs occur
How do I start?
• Greenfield project? JFDI! Otherwise…
• Automate highest value tests first
  • Important features
  • Where the most bugs occur
• Use TDD for new features
How do I start?
• Greenfield project? JFDI! Otherwise…
• Automate highest value tests first
  • Important features
  • Where the most bugs occur
• Use TDD for new features
• Add tests for bugs when they’re found
Further reading
Discussion

Contenu connexe

Tendances

Two Trains and Other Refactoring Analogies
Two Trains and Other Refactoring AnalogiesTwo Trains and Other Refactoring Analogies
Two Trains and Other Refactoring AnalogiesKevin London
 
We Continue Exploring Tizen: C# Components Proved to be of High Quality
We Continue Exploring Tizen: C# Components Proved to be of High QualityWe Continue Exploring Tizen: C# Components Proved to be of High Quality
We Continue Exploring Tizen: C# Components Proved to be of High QualityPVS-Studio
 
Behaviour-Driven Development
Behaviour-Driven DevelopmentBehaviour-Driven Development
Behaviour-Driven DevelopmentKerry Buckley
 
The real beginner's guide to android testing
The real beginner's guide to android testingThe real beginner's guide to android testing
The real beginner's guide to android testingEric (Trung Dung) Nguyen
 
Why Windows 8 drivers are buggy
Why Windows 8 drivers are buggyWhy Windows 8 drivers are buggy
Why Windows 8 drivers are buggyPVS-Studio
 
JAVASCRIPT TDD(Test driven Development) & Qunit Tutorial
JAVASCRIPT TDD(Test driven Development) & Qunit TutorialJAVASCRIPT TDD(Test driven Development) & Qunit Tutorial
JAVASCRIPT TDD(Test driven Development) & Qunit TutorialAnup Singh
 
Navigating the xDD Alphabet Soup
Navigating the xDD Alphabet SoupNavigating the xDD Alphabet Soup
Navigating the xDD Alphabet SoupDror Helper
 
Unit Testing in iOS - Ninjava Talk
Unit Testing in iOS - Ninjava TalkUnit Testing in iOS - Ninjava Talk
Unit Testing in iOS - Ninjava TalkLong Weekend LLC
 
Pyconie 2012
Pyconie 2012Pyconie 2012
Pyconie 2012Yaqi Zhao
 
ReactJS for Programmers
ReactJS for ProgrammersReactJS for Programmers
ReactJS for ProgrammersDavid Rodenas
 
Brief analysis of Media Portal 2 bugs
Brief analysis of Media Portal 2 bugsBrief analysis of Media Portal 2 bugs
Brief analysis of Media Portal 2 bugsPVS-Studio
 
iOS Unit Testing
iOS Unit TestingiOS Unit Testing
iOS Unit Testingsgleadow
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency InjectionIndrit Selimi
 
Inside PyMongo - MongoNYC
Inside PyMongo - MongoNYCInside PyMongo - MongoNYC
Inside PyMongo - MongoNYCMike Dirolf
 
Introduction to CDI and DI in Java EE 6
Introduction to CDI and DI in Java EE 6Introduction to CDI and DI in Java EE 6
Introduction to CDI and DI in Java EE 6Ray Ploski
 

Tendances (20)

TDD
TDDTDD
TDD
 
Two Trains and Other Refactoring Analogies
Two Trains and Other Refactoring AnalogiesTwo Trains and Other Refactoring Analogies
Two Trains and Other Refactoring Analogies
 
We Continue Exploring Tizen: C# Components Proved to be of High Quality
We Continue Exploring Tizen: C# Components Proved to be of High QualityWe Continue Exploring Tizen: C# Components Proved to be of High Quality
We Continue Exploring Tizen: C# Components Proved to be of High Quality
 
Behaviour-Driven Development
Behaviour-Driven DevelopmentBehaviour-Driven Development
Behaviour-Driven Development
 
The real beginner's guide to android testing
The real beginner's guide to android testingThe real beginner's guide to android testing
The real beginner's guide to android testing
 
Ecad final
Ecad finalEcad final
Ecad final
 
Why Windows 8 drivers are buggy
Why Windows 8 drivers are buggyWhy Windows 8 drivers are buggy
Why Windows 8 drivers are buggy
 
JAVASCRIPT TDD(Test driven Development) & Qunit Tutorial
JAVASCRIPT TDD(Test driven Development) & Qunit TutorialJAVASCRIPT TDD(Test driven Development) & Qunit Tutorial
JAVASCRIPT TDD(Test driven Development) & Qunit Tutorial
 
Navigating the xDD Alphabet Soup
Navigating the xDD Alphabet SoupNavigating the xDD Alphabet Soup
Navigating the xDD Alphabet Soup
 
Unit Testing in iOS - Ninjava Talk
Unit Testing in iOS - Ninjava TalkUnit Testing in iOS - Ninjava Talk
Unit Testing in iOS - Ninjava Talk
 
Pyconie 2012
Pyconie 2012Pyconie 2012
Pyconie 2012
 
ReactJS for Programmers
ReactJS for ProgrammersReactJS for Programmers
ReactJS for Programmers
 
Brief analysis of Media Portal 2 bugs
Brief analysis of Media Portal 2 bugsBrief analysis of Media Portal 2 bugs
Brief analysis of Media Portal 2 bugs
 
Spock Framework
Spock FrameworkSpock Framework
Spock Framework
 
Unit Testing in iOS
Unit Testing in iOSUnit Testing in iOS
Unit Testing in iOS
 
iOS Unit Testing
iOS Unit TestingiOS Unit Testing
iOS Unit Testing
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency Injection
 
Inside PyMongo - MongoNYC
Inside PyMongo - MongoNYCInside PyMongo - MongoNYC
Inside PyMongo - MongoNYC
 
Lab # 1
Lab # 1Lab # 1
Lab # 1
 
Introduction to CDI and DI in Java EE 6
Introduction to CDI and DI in Java EE 6Introduction to CDI and DI in Java EE 6
Introduction to CDI and DI in Java EE 6
 

Similaire à Tdd for BT E2E test community

Acceptance Testing With Selenium
Acceptance Testing With SeleniumAcceptance Testing With Selenium
Acceptance Testing With Seleniumelliando dias
 
Bdd for-dso-1227123516572504-8
Bdd for-dso-1227123516572504-8Bdd for-dso-1227123516572504-8
Bdd for-dso-1227123516572504-8Frédéric Delorme
 
Intro to TDD and BDD
Intro to TDD and BDDIntro to TDD and BDD
Intro to TDD and BDDJason Noble
 
Tdd pecha kucha_v2
Tdd pecha kucha_v2Tdd pecha kucha_v2
Tdd pecha kucha_v2Paul Boos
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiRan Mizrahi
 
Pro Java Fx – Developing Enterprise Applications
Pro Java Fx – Developing Enterprise ApplicationsPro Java Fx – Developing Enterprise Applications
Pro Java Fx – Developing Enterprise ApplicationsStephen Chin
 
Code igniter unittest-part1
Code igniter unittest-part1Code igniter unittest-part1
Code igniter unittest-part1Albert Rosa
 
Week1 programming challenges
Week1 programming challengesWeek1 programming challenges
Week1 programming challengesDhanu Srikar
 
Testing Legacy Rails Apps
Testing Legacy Rails AppsTesting Legacy Rails Apps
Testing Legacy Rails AppsRabble .
 
關於測試,我說的其實是......
關於測試,我說的其實是......關於測試,我說的其實是......
關於測試,我說的其實是......hugo lu
 
Test and refactoring
Test and refactoringTest and refactoring
Test and refactoringKenneth Ceyer
 
Java: Class Design Examples
Java: Class Design ExamplesJava: Class Design Examples
Java: Class Design ExamplesTareq Hasan
 
Ruby on Rails testing with Rspec
Ruby on Rails testing with RspecRuby on Rails testing with Rspec
Ruby on Rails testing with RspecBunlong Van
 
PVS-Studio vs Chromium. 3-rd Check
PVS-Studio vs Chromium. 3-rd CheckPVS-Studio vs Chromium. 3-rd Check
PVS-Studio vs Chromium. 3-rd CheckAndrey Karpov
 
Headache from using mathematical software
Headache from using mathematical softwareHeadache from using mathematical software
Headache from using mathematical softwarePVS-Studio
 
The First C# Project Analyzed
The First C# Project AnalyzedThe First C# Project Analyzed
The First C# Project AnalyzedPVS-Studio
 
2011-02-03 LA RubyConf Rails3 TDD Workshop
2011-02-03 LA RubyConf Rails3 TDD Workshop2011-02-03 LA RubyConf Rails3 TDD Workshop
2011-02-03 LA RubyConf Rails3 TDD WorkshopWolfram Arnold
 

Similaire à Tdd for BT E2E test community (20)

Rspec
RspecRspec
Rspec
 
Acceptance Testing With Selenium
Acceptance Testing With SeleniumAcceptance Testing With Selenium
Acceptance Testing With Selenium
 
Bdd for-dso-1227123516572504-8
Bdd for-dso-1227123516572504-8Bdd for-dso-1227123516572504-8
Bdd for-dso-1227123516572504-8
 
Intro to TDD and BDD
Intro to TDD and BDDIntro to TDD and BDD
Intro to TDD and BDD
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Tdd pecha kucha_v2
Tdd pecha kucha_v2Tdd pecha kucha_v2
Tdd pecha kucha_v2
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran Mizrahi
 
Pro Java Fx – Developing Enterprise Applications
Pro Java Fx – Developing Enterprise ApplicationsPro Java Fx – Developing Enterprise Applications
Pro Java Fx – Developing Enterprise Applications
 
Code igniter unittest-part1
Code igniter unittest-part1Code igniter unittest-part1
Code igniter unittest-part1
 
Week1 programming challenges
Week1 programming challengesWeek1 programming challenges
Week1 programming challenges
 
Testing Legacy Rails Apps
Testing Legacy Rails AppsTesting Legacy Rails Apps
Testing Legacy Rails Apps
 
Deixe o teste infectar você
Deixe o teste infectar vocêDeixe o teste infectar você
Deixe o teste infectar você
 
關於測試,我說的其實是......
關於測試,我說的其實是......關於測試,我說的其實是......
關於測試,我說的其實是......
 
Test and refactoring
Test and refactoringTest and refactoring
Test and refactoring
 
Java: Class Design Examples
Java: Class Design ExamplesJava: Class Design Examples
Java: Class Design Examples
 
Ruby on Rails testing with Rspec
Ruby on Rails testing with RspecRuby on Rails testing with Rspec
Ruby on Rails testing with Rspec
 
PVS-Studio vs Chromium. 3-rd Check
PVS-Studio vs Chromium. 3-rd CheckPVS-Studio vs Chromium. 3-rd Check
PVS-Studio vs Chromium. 3-rd Check
 
Headache from using mathematical software
Headache from using mathematical softwareHeadache from using mathematical software
Headache from using mathematical software
 
The First C# Project Analyzed
The First C# Project AnalyzedThe First C# Project Analyzed
The First C# Project Analyzed
 
2011-02-03 LA RubyConf Rails3 TDD Workshop
2011-02-03 LA RubyConf Rails3 TDD Workshop2011-02-03 LA RubyConf Rails3 TDD Workshop
2011-02-03 LA RubyConf Rails3 TDD Workshop
 

Plus de Kerry Buckley

Testing http calls with Webmock and VCR
Testing http calls with Webmock and VCRTesting http calls with Webmock and VCR
Testing http calls with Webmock and VCRKerry Buckley
 
Ruby nooks & crannies
Ruby nooks & cranniesRuby nooks & crannies
Ruby nooks & cranniesKerry Buckley
 
Javasccript MV* frameworks
Javasccript MV* frameworksJavasccript MV* frameworks
Javasccript MV* frameworksKerry Buckley
 
What I learned from Seven Languages in Seven Weeks (IPRUG)
What I learned from Seven Languages in Seven Weeks (IPRUG)What I learned from Seven Languages in Seven Weeks (IPRUG)
What I learned from Seven Languages in Seven Weeks (IPRUG)Kerry Buckley
 
Adastral Park code retreat introduction
Adastral Park code retreat introductionAdastral Park code retreat introduction
Adastral Park code retreat introductionKerry Buckley
 
MongoMapper lightning talk
MongoMapper lightning talkMongoMapper lightning talk
MongoMapper lightning talkKerry Buckley
 
The secret life of bees
The secret life of beesThe secret life of bees
The secret life of beesKerry Buckley
 
Background processing
Background processingBackground processing
Background processingKerry Buckley
 
Katas, Contests and Coding Dojos
Katas, Contests and Coding DojosKatas, Contests and Coding Dojos
Katas, Contests and Coding DojosKerry Buckley
 
Kanban and Iterationless Working
Kanban and Iterationless WorkingKanban and Iterationless Working
Kanban and Iterationless WorkingKerry Buckley
 
Software Development Trends
Software Development TrendsSoftware Development Trends
Software Development TrendsKerry Buckley
 

Plus de Kerry Buckley (20)

Jasmine
JasmineJasmine
Jasmine
 
Testing http calls with Webmock and VCR
Testing http calls with Webmock and VCRTesting http calls with Webmock and VCR
Testing http calls with Webmock and VCR
 
BDD with cucumber
BDD with cucumberBDD with cucumber
BDD with cucumber
 
Ruby nooks & crannies
Ruby nooks & cranniesRuby nooks & crannies
Ruby nooks & crannies
 
TDD refresher
TDD refresherTDD refresher
TDD refresher
 
Javasccript MV* frameworks
Javasccript MV* frameworksJavasccript MV* frameworks
Javasccript MV* frameworks
 
7li7w devcon5
7li7w devcon57li7w devcon5
7li7w devcon5
 
What I learned from Seven Languages in Seven Weeks (IPRUG)
What I learned from Seven Languages in Seven Weeks (IPRUG)What I learned from Seven Languages in Seven Weeks (IPRUG)
What I learned from Seven Languages in Seven Weeks (IPRUG)
 
Functional ruby
Functional rubyFunctional ruby
Functional ruby
 
Adastral Park code retreat introduction
Adastral Park code retreat introductionAdastral Park code retreat introduction
Adastral Park code retreat introduction
 
MongoMapper lightning talk
MongoMapper lightning talkMongoMapper lightning talk
MongoMapper lightning talk
 
Ruby
RubyRuby
Ruby
 
Cloud
CloudCloud
Cloud
 
The secret life of bees
The secret life of beesThe secret life of bees
The secret life of bees
 
Background processing
Background processingBackground processing
Background processing
 
Katas, Contests and Coding Dojos
Katas, Contests and Coding DojosKatas, Contests and Coding Dojos
Katas, Contests and Coding Dojos
 
Rack
RackRack
Rack
 
Doing REST Right
Doing REST RightDoing REST Right
Doing REST Right
 
Kanban and Iterationless Working
Kanban and Iterationless WorkingKanban and Iterationless Working
Kanban and Iterationless Working
 
Software Development Trends
Software Development TrendsSoftware Development Trends
Software Development Trends
 

Dernier

Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 

Dernier (20)

Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

Tdd for BT E2E test community

  • 1. Test-driven development Kerry Buckley 26 July 2012
  • 2. Who the hell are you?
  • 4. Test-driven development From Wikipedia, the free encyclopedia Test-driven development (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes a failing automated test case that defines a desired improvement or new function, then produces code to pass that test and finally refactors the new code to acceptable standards.
  • 7. Terms • Unit testing • Integration testing
  • 8. Terms • Unit testing • Integration testing • Acceptance testing
  • 9. Towards TDD 0. manual testing Write Design Test Release code
  • 10. Towards TDD 1. automated testing Write Write Design Test Release code tests
  • 11. Towards TDD 2. test-first development Write Write Design Test Release tests code
  • 12. Towards TDD 3. test-driven development Design Write Run Write test test code Release Run Refactor tests
  • 13. Towards TDD 3. test-driven development Red Green Refactor
  • 14. Beyond TDD? 4. behaviour-driven development Executable Customer Release examples Red Green TDD Refactor
  • 16. Unit test tools • Java: JUnit, TestNG…
  • 17. Unit test tools • Java: JUnit, TestNG… • C#: NUnit, csUnit…
  • 18. Unit test tools • Java: JUnit, TestNG… • C#: NUnit, csUnit… • Ruby: Test::Unit, MiniTest, RSpec…
  • 19. Unit test tools • Java: JUnit, TestNG… • C#: NUnit, csUnit… • Ruby: Test::Unit, MiniTest, RSpec… • Javascript: JSUnit, JSSpec, Jasmine…
  • 20. Unit test tools • Java: JUnit, TestNG… • C#: NUnit, csUnit… • Ruby: Test::Unit, MiniTest, RSpec… • Javascript: JSUnit, JSSpec, Jasmine… • and many more
  • 23. Acceptance test tools • Fit/Fitnesse • Exactor
  • 24. Acceptance test tools • Fit/Fitnesse • Exactor • Selenium
  • 25. Acceptance test tools • Fit/Fitnesse • Exactor • Selenium • Cucumber
  • 26. Acceptance test tools • Fit/Fitnesse • Exactor • Selenium • Cucumber • Windmill
  • 27. Acceptance test tools • Fit/Fitnesse • Exactor • Selenium • Cucumber • Windmill • etc
  • 28. Anatomy of a test # Given some test accounts ➊ Setup account_1 = Account.new(100) account_2 = Account.new(50) # When I transfer money ➋ Act transfer(20, from: account_1, to: account_2) # Then the balances should be updated ➌ Assert account_1.balance.should eq(80) account_2.balance.should eq(70)
  • 29. Acceptance tests Example using Cucumber
  • 30. Acceptance tests Feature: Logging in and out Scenario: User is greeted on login Given the user "Kerry" has an account When he logs in Then he should see "Welcome, Kerry"
  • 31. Acceptance tests $ cucumber login.feature Feature: Logging in and out Scenario: User is greeted on login Given the user "Kerry" has an account When he logs in Then he should see "Welcome, Kerry" 1 scenario (1 undefined) 3 steps (3 undefined) 0m0.002s # login.feature:3 # login.feature:4 # login.feature:5 # login.feature:6 You can implement step definitions for undefined steps with Given /^the user "(.*?)" has an account$/ do |arg1| pending # express the regexp above with the code you wish end ...
  • 32. Acceptance tests Given /^the user "(.*?)" has an account$/ do |username| @user = User.create username: username, password: secret end When /^he logs in$/ do visit "/login" fill_in "User name", :with => @user.username fill_in "Password", :with => "secret" click_button "Log in" end Then /^he should see "(.*?)"$/ do |text| page.should have_text(text) end
  • 33. Acceptance tests $ cucumber login.feature Feature: Logging in and out Scenario: User is greeted on login Given the user "Kerry" has an account # steps.rb:24 When he logs in # steps.rb:28 Then he should see "Welcome, Kerry" # steps.rb:35 expected there to be content "Log out" in "Welcome to the site!nThere's nothing here yet.” (RSpec::Expectations::ExpectationNotMetError) ./steps.rb:36:in `/^he should see "(.*?)"$/' login.feature:6:in `Then he should see "Welcome, Kerry"' Failing Scenarios: cucumber login.feature:3 # Scenario: User is greeted on login 1 scenario (1 failed) 3 steps (1 failed, 2 passed) 0m0.002s
  • 34. Acceptance tests $ cucumber login.feature Feature: Logging in and out Scenario: User is greeted on login Given the user "Kerry" has an account # steps.rb:24 When he logs in # steps.rb:28 Then he should see "Welcome, Kerry" # steps.rb:35 1 scenario (1 passed) 3 steps (3 passed) 0m0.003s
  • 36. Unit tests describe Calculator do it "can add two numbers" do calculator = Calculator.new calculator.add(2, 3).should eq(" 5") end end
  • 37. Unit tests $ rspec calculator_spec.rb calculator_spec.rb:1:in `<top (required)>': uninitialized constant Calculator (NameError)
  • 39. Unit tests $ rspec calculator_spec.rb F Failures: 1) Calculator can add two numbers Failure/Error: calculator.add(2, 3).should eq(5) NoMethodError: undefined method `add' for #<Calculator:0x007fa0ac1ea718> # ./calculator_spec.rb:6:in `block (2 levels) in <top (required)>' Finished in 0.00035 seconds 1 example, 1 failure Failed examples: rspec ./calculator_spec.rb:4 # Calculator can add two numbers
  • 40. Unit tests class Calculator def add end end
  • 41. Unit tests $ rspec calculator_spec.rb F Failures: 1) Calculator can add two numbers Failure/Error: calculator.add(2, 3).should eq(" 5") ArgumentError: wrong number of arguments (2 for 0) #  ./calculator.rb:2:in `add' #  ./calculator_spec.rb:6:in `block (2 levels) in <top (required)>' Finished in 0.0005 seconds 1 example, 1 failure Failed examples: rspec ./calculator_spec.rb:4 # Calculator can add two numbers
  • 42. Unit tests class Calculator def add a, b end end
  • 43. Unit tests $ rspec calculator_spec.rb F Failures: 1) Calculator can add two numbers Failure/Error: calculator.add(2, 3).should eq(" 5") expected: " 5" got: nil (compared using ==) # ./calculator_spec.rb:6:in `block (2 levels) in <top (required)>' Finished in 0.00066 seconds 1 example, 1 failure Failed examples: rspec ./calculator_spec.rb:4 # Calculator can add two numbers
  • 44. Unit tests class Calculator def add a, b " #{a + b}" end end
  • 45. Unit tests $ rspec calculator_spec.rb . Finished in 0.00065 seconds 1 example, 0 failures
  • 46. Unit tests describe Calculator do it "can add two numbers" do calculator = Calculator.new calculator.add(2, 3).should eq(" 5") end it "pads output to eight characters" do calculator = Calculator.new calculator.add(2, 2).should eq(" 4") calculator.add(5, 5).should eq(" 10") end end
  • 47. Unit tests $ rspec calculator_spec.rb .F Failures: 1) Calculator pads output to eight characters Failure/Error: calculator.add(5, 5).should eq(" 10") expected: " 10" got: " 10" (compared using ==) # ./calculator_spec.rb:12:in `block (2 levels) in <top (required)>' Finished in 0.00086 seconds 2 examples, 1 failure Failed examples: rspec ./calculator_spec.rb:9 # Calculator pads output to eight characters
  • 48. Unit tests class Calculator def add a, b "%8i" % (a + b) end end
  • 49. Unit tests $ rspec calculator_spec.rb .. Finished in 0.00076 seconds 2 examples, 0 failures
  • 50. Unit tests describe Calculator do it "can add two numbers" do calculator = Calculator.new calculator.add(2, 3).should eq(" 5") end it "pads output to eight characters" do calculator = Calculator.new calculator.add(2, 2).should eq(" 4") calculator.add(5, 5).should eq(" 10") end end
  • 51. Unit tests describe Calculator do before do @calculator = Calculator.new end it "can add two numbers" do @calculator.add(2, 3).should eq(" 5") end it "pads output to eight characters" do @calculator.add(2, 2).should eq(" 4") @calculator.add(5, 5).should eq(" 10") end end
  • 52. Unit tests $ rspec calculator_spec.rb .. Finished in 0.00075 seconds 2 examples, 0 failures
  • 53. Unit tests describe Calculator do before do @calculator = Calculator.new end it "can add two numbers" do @calculator.add(2, 3).should eq(" 5") end it "can subtract two numbers" do @calculator.subtract(3, 1).should eq(" 2") end it "pads output to eight characters" do @calculator.add(2, 2).should eq(" 4") @calculator.add(5, 5).should eq(" 10") end end
  • 54. Unit tests class Calculator def add a, b "%8i" % (a + b) end def subtract a, b "%8i" % (a - b) end end
  • 55. Unit tests $ rspec calculator_spec.rb ... Finished in 0.00085 seconds 3 examples, 0 failures
  • 56. Unit tests class Calculator def add a, b "%8i" % (a + b) end def subtract a, b "%8i" % (a - b) end end
  • 57. Unit tests class Calculator def add a, b format(a + b) end def subtract a, b format(a - b) end private def format number "%8i" % number end end
  • 58. Unit tests $ rspec calculator_spec.rb ... Finished in 0.00086 seconds 3 examples, 0 failures
  • 59. Unit tests describe Calculator do before do @calculator = Calculator.new end it "can add two numbers" do @calculator.add(2, 3).should eq(" 5") end it "pads output to eight characters" do @calculator.add(2, 2).should eq(" 4") @calculator.add(5, 5).should eq(" 10") end end
  • 60. Unit tests $ rspec --format doc calculator_spec.rb Calculator can add two numbers can subtract two numbers pads output to eight characters Finished in 0.00094 seconds 3 examples, 0 failures
  • 61. A good test suite…
  • 62. A good test suite… • Expresses the programmer’s intent
  • 63. A good test suite… • Expresses the programmer’s intent • Gives confidence that the system works
  • 64. A good test suite… • Expresses the programmer’s intent • Gives confidence that the system works • Runs quickly
  • 65. A good test suite… • Expresses the programmer’s intent • Gives confidence that the system works • Runs quickly • Gives clear failure messages
  • 66. A good test suite… • Expresses the programmer’s intent • Gives confidence that the system works • Runs quickly • Gives clear failure messages • Is well-maintained
  • 67. A good test suite… • Expresses the programmer’s intent • Gives confidence that the system works • Runs quickly • Gives clear failure messages • Is well-maintained • Isolates each area under test
  • 69. Benefits of TDD • Less manual testing required
  • 70. Benefits of TDD • Less manual testing required • Faster feedback
  • 71. Benefits of TDD • Less manual testing required • Faster feedback • Safety net to make changes safer
  • 72. Benefits of TDD • Less manual testing required • Faster feedback • Safety net to make changes safer • Shorter cycle time
  • 73. Benefits of TDD • Less manual testing required • Faster feedback • Safety net to make changes safer • Shorter cycle time • Reduced rework
  • 74. Benefits of TDD • Less manual testing required • Faster feedback • Safety net to make changes safer • Shorter cycle time • Reduced rework • Improved design
  • 76. What about testers? • Less tedious repetitive manual testing
  • 77. What about testers? • Less tedious repetitive manual testing • Concentrate on exploratory testing
  • 78. What about testers? • Less tedious repetitive manual testing • Concentrate on exploratory testing • Identify edge cases and ‘sad path’ tests
  • 79. What about testers? • Less tedious repetitive manual testing • Concentrate on exploratory testing • Identify edge cases and ‘sad path’ tests • Help define acceptance tests
  • 80. How do I start?
  • 81. How do I start? • Greenfield project? JFDI! Otherwise…
  • 82. How do I start? • Greenfield project? JFDI! Otherwise… • Automate highest value tests first
  • 83. How do I start? • Greenfield project? JFDI! Otherwise… • Automate highest value tests first • Important features
  • 84. How do I start? • Greenfield project? JFDI! Otherwise… • Automate highest value tests first • Important features • Where the most bugs occur
  • 85. How do I start? • Greenfield project? JFDI! Otherwise… • Automate highest value tests first • Important features • Where the most bugs occur • Use TDD for new features
  • 86. How do I start? • Greenfield project? JFDI! Otherwise… • Automate highest value tests first • Important features • Where the most bugs occur • Use TDD for new features • Add tests for bugs when they’re found

Notes de l'éditeur

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n