SlideShare ist ein Scribd-Unternehmen logo
1 von 39
Downloaden Sie, um offline zu lesen
Acceptance Test Driven Development
Bringing Testers and Developers Together




                         John Ferguson Smart
                         Wakaleo Consulting Ltd.
                         http://www.wakaleo.com
                         Email: john.smart@wakaleo.com
                         Twitter: wakaleo
Introduction
So what’s this talk about, anyway
 Acceptance tests as a communication tool
 Acceptance Test Driven Development
 BDD-style Acceptance Tests - easyb
Acceptance Tests
Acceptance Tests - a key Agile practice
 A communication tool
 Owned by the customer
 Determine when a feature is ‘done’
 Written together (customer, developer, tester)
 Focus on What, not How
Acceptance Tests
Acceptance Tests - how far do you go?
 In depth tests or examples of system usage?
 Exhaustive Tests or Sample Stories?
Acceptance Tests
Acceptance Tests - a key Agile practice
     User Story 1 - Transfer funds
   User Story 11- -Calculate my tax rate
    User Story      Calculate my tax rate
As a bank client, I want to transfer funds from
my current account to my savings account, so
 As a tax payer, I want to be able to calculate my
that I a taxearn more interest able to calculate my
  As can payer, I want to be
 tax online, so that I can put enough money aside.
  tax online, so that I can put enough money aside.



            So how do we know when
              this feature is done?
Acceptance Tests
Acceptance Tests - a key Agile practice

    User Story 11- ---Acceptance Testsrate
     User Story 11Calculate my tax
      User Story      Transfer funds
     User Story      Calculate my tax rate
- As a bank client,money between two accounts from
  Client can transfer I want to transfer funds
- my current account to my savings account, so
  Client can’t transfer negative amount
- Client can’t transfer wantthan currentto calculate my
   As a tax payer, I more to be able account balance
  that I a taxearn more interest able to calculate my
    As can payer, I want to be
- Client can’t transfer from a blocked accountmoney aside.
   tax online, so that I can put enough
   tax online, so that I can put enough money aside.



               So how do we know when
                 this feature is done?


                                  Let’s write some
                                 Acceptance Criteria
Acceptance Tests
Acceptance Criteria
 Conditions that must be met before the story is complete
 Provided by the customer
 Some folks use a more formal notation
 How do I get my tests? Just add some examples!




                              User Story 1 - Acceptance Tests
                       - Client can transfer money between two accounts
                       - Client can’t transfer negative amount
                       - Client can’t transfer more than current account balance
                       - Client can’t transfer from a blocked account
Acceptance Test-Driven Development
Acceptance Tests drive work during the iteration




                            Pick a story card
                            Write the acceptance tests
                            Automate the acceptance tests
                            Implement the user story


 Iteration n-1       Iteration n                   Iteration n+1
Acceptance Test-Driven Development
Implementing/Automating the Acceptance Tests
 Acceptance Tests become ‘executable’
 Focus is still on communication
 You don’t need to use the same language as the application
Tools for the job
What tools exist? Two main approaches
 Narrative
  easyb, JBehave, rspec, Cucumber,...
 Table-based
  Fitnesse,...
Introducing easyb
So what is easyb, anyway?
 A BDD testing framework for Java
 Make testing clearer and easier to write
 Make tests self-documenting
 Help developers focus on the requirements
 Based on Groovy
 Java-like syntax
 Quick to write
 Full access to Java classes and APIs
 Well-suited to Acceptance Tests




                                             BDD Acceptance Testing
Easyb in Action
Easyb supports Specifications and Stories
 Specifications express requirements as simple statements
 Stories use the “given-when-then” approach
Easyb Specifications
Writing Easyb Specifications
 Simple and informal
 Easy to write
 Very similar to acceptance criteria
Easyb Specifications
Writing Easyb Specifications
      User Story 1 - Acceptance Tests
- Client can transfer money between two accounts
- Client can’t transfer negative amount
- Client can’t transfer more than current account balance
- Client can’t transfer from a blocked account

                                                            Start off with our acceptance criteria
    AccountTransfer.specifications

     description "A client should be able to transfer money between accounts"

     it   "should   let   a client transfer   money from a current to a savings a/c"
     it   "should   not   allow a client to   transfer a negative amount"
     it   "should   not   allow a client to   transfer more than the current balance"
     it   "should   not   allow a client to   transfer from a blocked account"



                                               Express these in Easyb
Easyb Specifications
Writing Easyb Specifications
 Executable Requirements

 description "A client should be able to transfer money between accounts"

 it   "should   let   a client transfer   money from a current to a savings a/c"
 it   "should   not   allow a client to   transfer a negative amount"
 it   "should   not   allow a client to   transfer more than the current balance"
 it   "should   not   allow a client to   transfer from a blocked account"

                                                                      This code will run!




                                               The tests are marked as ‘PENDING’
Easyb Specifications
Writing Easyb Specifications
 HTML Progress reports
Easyb Specifications
 Writing Easyb Specifications
  Implementing the tests
   package com.wakaleo.accounts.domain

   description "A client should be able to transfer money between accounts"

   it   "should let a client transfer money from a current to a savings a/c", {
   	     current = new Account(200)
   	     savings = new Account(300)           A developer implements the test in Groovy
   	
   	     current.transferTo(savings, 50)
   	
   	     savings.balance.shouldBe 350
   	     current.balance.shouldBe 150
   }
   it   "should not allow a client to transfer a negative amount"
   it   "should not allow a client to transfer more than the current balance"
   it   "should not allow a client to transfer from a blocked account"




No longer pending


  Still pending...
Easyb Stories
Writing Easyb Stories
 Use a narrative approach
 Describe a precise requirement
 Can be understood by a stakeholder
 Usually made up of a set of scenarios
 Use an easy-to-understand structure:
   Given [a context]...
   When [something happens]...
   Then [something else happens]...
Easyb Stories
Building an easyb story
 A story is made up of scenarios
 Scenarios validate specific behaviour

       User Story 1 - Acceptance Tests
 - Client can transfer money between two accounts
 - Client can’t transfer negative amount
 - Client can’t transfer more than current account balance
 - Client can’t transfer from a blocked account


  AccountTransfer.story

  scenario   "A   client   can transfer money from a current to a savings a/c"
  scenario   "A   client   is not allowed to transfer a negative amount"
  scenario   "A   client   is not allowed to transfer more than the current balance"
  scenario   "A   client   is not allowed to transfer from a blocked account"
Easyb Stories
Anatomy of an easyb story
scenario "A client can transfer money from a current to a savings a/c", {
	 given 'a current a/c with $200 and a savings a/c with $300'
	 when 'you transfer $50 from the current a/c to the savings a/c'
	 then 'the savings a/c should have $350 and the current a/c $150'
}

 “Scenario”: corresponds to precise requirement
 “Given”: the context in which this requirement applies
 “When”: An event or action
 “Then”: The expected results of this action
Easyb Stories
Implementing the scenario
 package com.wakaleo.accounts.domain

 scenario "A client can transfer money from a current to a savings a/c", {
 	 given 'a current a/c with $200 and a savings a/c with $300', {
 	 	 current = new Account(200)
 	 	 savings = new Account(300)	  	 	 	
 	 }
 	 when 'you transfer $50 from the current a/c to the savings a/c', {
 	 	 current.transferTo(savings, 50)	 	
 	 }
 	 then 'the savings a/c should have $350 and the current a/c $150', {
 	 	 savings.balance.shouldBe 350
 	 	 current.balance.shouldBe 150
 	 }	 	 	
 }

 scenario "A client is not allowed to transfer a negative amount"
 scenario "A client is not allowed to transfer more than the current balance"
 scenario "A client is not allowed to transfer from a blocked account"
Easyb Stories
Implementing the scenario - an alternative solution
 package com.wakaleo.accounts.domain

 scenario "A client can transfer money from a current to a savings a/c", {
 	 given 'a current a/c with $200', {
 	 	 current = new Account(200)                    Using ‘and’ for more clarity
 	 }
 	 and 'a savings a/c with $300', {
 	 	 savings = new Account(300)	  	 	 	
     }
     when 'you transfer $50 from the current a/c to the savings a/c', {
 	 	 current.transferTo(savings, 50)	 	
 	 }
 	 then 'the savings a/c should have $350', {
 	 	 savings.balance.shouldBe 350
 	 }
 	 and 'the current a/c should have $150', {
 	 	 current.balance.shouldBe 150
 	 }
 }
 scenario "A client is not allowed to transfer a negative amount"
 scenario "A client is not allowed to transfer more than the current balance"
 scenario "A client is not allowed to transfer from a blocked account"
Easyb assertions
Ensuring what should be
 The shouldBe syntax:
 Intuitive, readable and flexible
  account.balance.shouldBe initialAmount

 Comes in many flavors
  account.balance.shouldBeEqualTo initialAmount


  account.balance.shouldNotBe 0


   account.balance.shouldBeGreaterThan 0


    account.shouldHave(balance:initialAmount)
Easyb Stories
Implementing another scenario - error conditions
package com.wakaleo.accounts.domain

scenario "A client can transfer money from a current to a savings a/c", {
   ...
}
scenario "A client is not allowed to transfer a negative amount", {
	   given 'a current a/c with $200', {
	   	   current = new Account(200)
	   }
	   and 'a savings a/c with $300', {
	   	   savings = new Account(300)		  	   	
	   }
	   when "you try to transfer a negative amount", {              Create a closure
	   	   transferNegativeAmount = {                         representing this operation
	   	   	   current.transferTo(savings, -50)
	   	   }
	   }
	   then "an IllegalTransferException should be thrown", {
	   	   ensureThrows(IllegalTransferException.class) {
	   	   	   transferNegativeAmount()                         Fail if the exception is not
	   	   }                                                               thrown
	   }
}
scenario "A client is not allowed to transfer more than the current balance"
scenario "A client is not allowed to transfer from a blocked account"
Easyb fixtures
Structuring your tests...fixtures in easyb
 Setting up the test environment...
  Similar to JUnit fixtures @Before and @BeforeClass
  before is run at the start of the whole story
  before_each is run before each scenario
  Useful for setting up databases, test servers, etc.
Easyb fixtures
Refactoring our scenarios - before and before_each
before_each "setup the test accounts", {
	    given 'a current a/c with $200', {
	    	    current = new Account(200)                       This will be done before
	    }
	    and 'a savings a/c with $300', {
                                                                each scenario
	    	    savings = new Account(300)	 	  	    	
	    }
}

scenario "A client can transfer money from a current to a savings a/c", {
     when 'you transfer $50 from the current a/c to the savings a/c', {
	    	    current.transferTo(savings, 50)	 	
	    }
	    then 'the savings a/c should have $350 and the current a/c $150', {
	    	    savings.balance.shouldBe 350
	    }
	    and 'the current a/c should have $150', {
	    	    current.balance.shouldBe 150
	    }
}

scenario "A client is not allowed to transfer a negative amount", {
	    when "you try to transfer a negative amount", {
	    	    transferNegativeAmount = {
	    	    	    current.transferTo(savings, -50)
	    	    }
	    }
	    then "an IllegalTransferException should be thrown", {
	    	    ensureThrows(IllegalTransferException.class) {
	    	    	    transferNegativeAmount()
	    	    }
	    }
}
Easyb fixtures
Shared behaviour
 Refactor common code in easyb scenarios
 shared_behavior "shared behaviors", {
   given "a string", {
     var = ""                                     Common behavior (‘shared_behavior’)
   }
   when "the string is hello world", {
     var = "hello world"
   }
 }

 scenario "first scenario", {
   it_behaves_as "shared behaviors"
  
   then "the string should start with hello", {       Reused here (‘it_behaves_as’)...
     var.shouldStartWith "hello"
   }
 }

 scenario "second scenario", {
   it_behaves_as "shared behaviors"
  
   then "the string should end with world", {           ...and here
     var.shouldEndWith "world"
   }
 }
Web testing with easyb
Easyb is convenient for web testing
 BDD/Functional tests
 Run against a test server, or use Jetty
 Use your choice of web testing frameworks
  Selenium
  JWebUnit
  ...
Web testing with easyb
Many options - let’s look at two
 Selenium
 Runs in a browser
 High-level API
 Runs slower and more work to set up
 JWebUnit
 Simulates a browser
 Runs faster, easy to set up
 API slightly lower level
Web testing with easyb
An example - writing functional tests with JWebUnit
import net.sourceforge.jwebunit.junit.WebTester

before_each "initialize a web test client", {                Set up a JWebUnit client
  given "we have a web test client", {
	   tester = new WebTester()
	   tester.setBaseUrl("http://localhost:8080/tweeter-web")
  }
}

scenario "User signup should add a new user", {
	
	   when "I click on the sign up button on the home page", {
	   	    tester.beginAt("/home")                                      Click on a link
	   	    tester.clickLinkWithText("Sign up now!")
	   }
	   and "I enter a new username and password", {
	   	    tester.setTextField("username", "jane")                 Enter some values
	   	    tester.setTextField("password", "tiger")
	   	    tester.submit()
	   }
	   then "the application should log me on as the new user and show a welcome message", {
	   	    tester.assertTextPresent("Hi jane!")
	   }                                                          Check the results
}
Easyb reports
The easyb HTML report




                        Test results summary

                           Unimplemented stories



                               Failed stories
Easyb reports
The easyb HTML report

                        Test results summary




                          Test failure details




                         Unimplemented stories
Other Approaches
How does easyb compare with other tools?
 Cucumber, RSpec (Ruby) - very similar to easyb
 FitNesse - wikis and tables
 Concordion - marked-up HTML
FitNesse
FitNesse - wiki-based acceptance tests
 Test data is written at tables on a Wiki
 Java classes implement the tests behind the scenes
FitNesse
FitNesse - wiki-based acceptance tests
                    Test data and scenarios as a table




                Test data                           Expected results
FitNesse
FitNesse - wiki-based acceptance tests




                       Testers can write/edit the Wiki pages




                    You can also import to and from Excel
FitNesse
    FitNesse - wiki-based acceptance tests
                              public class TransferMoneyBetweenAccounts {
Tests are implemented by      	   private BigDecimal savingsBalance;
      Java classes            	   private BigDecimal currentBalance;
                              	   private BigDecimal transfer;
                              	   private BigDecimal finalSavingsBalance;
    Each column has a         	   private BigDecimal finalCurrentBalance;
                              	   private boolean exceptionThrown;
     field in the class
                              	
                              	   public void setSavingsBalance(BigDecimal savingsBalance) {...}
                              	   public void setCurrentBalance(BigDecimal currentBalance) {...}
                              	   public void setTransfer(BigDecimal transfer) {...}
                                  public BigDecimal finalCurrentBalance() {...}
   Expected results have      	   public BigDecimal finalSavingsBalance() {...}
          getters             	   public boolean exceptionThrown() {...}

                              	   public void execute() {
                              	   	   Account currentAccount = new Account(currentBalance);
                              	   	   Account savingsAccount = new Account(savingsBalance);
                              	   	
                              	   	   exceptionThrown = false;
                              	   	   try {
                              	   	   	   currentAccount.transferTo(savingsAccount, transfer);
        Performing the test   	   	   	   finalCurrentBalance = currentAccount.getBalance();
                              	   	   	   finalSavingsBalance = savingsAccount.getBalance();
                              	   	   } catch (IllegalTransferException e) {
                              	   	   	   exceptionThrown = true;
                              	   	   }
                                  }
Commercial options?
There are also some commercial tools out there...
 GreenPepper
  Supports tables and BDD-style
  Nice tool integration (Confluence, Maven,...)
 Twixt
  Thoughtworks product, focus on web testing
 Others?
Thank You



     John Ferguson Smart
     Wakaleo Consulting Ltd.
     http://www.wakaleo.com
     Email: john.smart@wakaleo.com
     Twitter: wakaleo

Weitere ähnliche Inhalte

Andere mochten auch

Testing: Python, Java, Groovy, etc.
Testing: Python, Java, Groovy, etc.Testing: Python, Java, Groovy, etc.
Testing: Python, Java, Groovy, etc.Russel Winder
 
Testing Storm components with Groovy and Spock
Testing Storm components with Groovy and SpockTesting Storm components with Groovy and Spock
Testing Storm components with Groovy and SpockEugene Dvorkin
 
Acceptance test driven development (attd) cycle
Acceptance test driven development (attd) cycleAcceptance test driven development (attd) cycle
Acceptance test driven development (attd) cycleGiuseppe Torchia
 
Spock Testing Framework - The Next Generation
Spock Testing Framework - The Next GenerationSpock Testing Framework - The Next Generation
Spock Testing Framework - The Next GenerationBTI360
 
Acceptance Test Driven Development at StarWest 2014
Acceptance Test Driven Development at StarWest 2014Acceptance Test Driven Development at StarWest 2014
Acceptance Test Driven Development at StarWest 2014jaredrrichardson
 
Automated cceptance testing using Fitnesse & Selenium
Automated cceptance testing using Fitnesse & SeleniumAutomated cceptance testing using Fitnesse & Selenium
Automated cceptance testing using Fitnesse & Seleniummayurairon
 
JavaLand: Quantified Social - Fitness-Geräte und -Portale mit Agorava
JavaLand: Quantified Social - Fitness-Geräte und -Portale mit AgoravaJavaLand: Quantified Social - Fitness-Geräte und -Portale mit Agorava
JavaLand: Quantified Social - Fitness-Geräte und -Portale mit AgoravaWerner Keil
 
TestWorks Conf 2015 Beefing up FitNesse - Arjan Molenaar
TestWorks Conf 2015 Beefing up FitNesse - Arjan MolenaarTestWorks Conf 2015 Beefing up FitNesse - Arjan Molenaar
TestWorks Conf 2015 Beefing up FitNesse - Arjan MolenaarXebia Nederland BV
 
Methodologies for Test-Driven Development of OSGi enabled Embedded Devices - ...
Methodologies for Test-Driven Development of OSGi enabled Embedded Devices - ...Methodologies for Test-Driven Development of OSGi enabled Embedded Devices - ...
Methodologies for Test-Driven Development of OSGi enabled Embedded Devices - ...mfrancis
 
Fitnesse user acceptance test - Presentation
Fitnesse   user acceptance test - PresentationFitnesse   user acceptance test - Presentation
Fitnesse user acceptance test - PresentationSunil Kumar Gunasekaran
 
FitNesse With Scala
FitNesse With ScalaFitNesse With Scala
FitNesse With ScalaKnoldus Inc.
 
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)Jen Wong
 
Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)
Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)
Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)Peter Kofler
 
Automatic web ui testing
Automatic web ui testingAutomatic web ui testing
Automatic web ui testingAlex van Assem
 

Andere mochten auch (19)

User story workflow (eng)
User story workflow (eng)User story workflow (eng)
User story workflow (eng)
 
Testing: Python, Java, Groovy, etc.
Testing: Python, Java, Groovy, etc.Testing: Python, Java, Groovy, etc.
Testing: Python, Java, Groovy, etc.
 
Testing Storm components with Groovy and Spock
Testing Storm components with Groovy and SpockTesting Storm components with Groovy and Spock
Testing Storm components with Groovy and Spock
 
Acceptance test driven development (attd) cycle
Acceptance test driven development (attd) cycleAcceptance test driven development (attd) cycle
Acceptance test driven development (attd) cycle
 
ATDD in practice
ATDD in practiceATDD in practice
ATDD in practice
 
Specflow - Criando uma ponte entre desenvolvedores.
Specflow - Criando uma ponte entre desenvolvedores.Specflow - Criando uma ponte entre desenvolvedores.
Specflow - Criando uma ponte entre desenvolvedores.
 
Spock Testing Framework - The Next Generation
Spock Testing Framework - The Next GenerationSpock Testing Framework - The Next Generation
Spock Testing Framework - The Next Generation
 
Acceptance Test Driven Development at StarWest 2014
Acceptance Test Driven Development at StarWest 2014Acceptance Test Driven Development at StarWest 2014
Acceptance Test Driven Development at StarWest 2014
 
Automated cceptance testing using Fitnesse & Selenium
Automated cceptance testing using Fitnesse & SeleniumAutomated cceptance testing using Fitnesse & Selenium
Automated cceptance testing using Fitnesse & Selenium
 
JavaLand: Quantified Social - Fitness-Geräte und -Portale mit Agorava
JavaLand: Quantified Social - Fitness-Geräte und -Portale mit AgoravaJavaLand: Quantified Social - Fitness-Geräte und -Portale mit Agorava
JavaLand: Quantified Social - Fitness-Geräte und -Portale mit Agorava
 
TestWorks Conf 2015 Beefing up FitNesse - Arjan Molenaar
TestWorks Conf 2015 Beefing up FitNesse - Arjan MolenaarTestWorks Conf 2015 Beefing up FitNesse - Arjan Molenaar
TestWorks Conf 2015 Beefing up FitNesse - Arjan Molenaar
 
Fitnesse, Watir and Ruby Based Test Automation System
Fitnesse, Watir and Ruby Based Test Automation SystemFitnesse, Watir and Ruby Based Test Automation System
Fitnesse, Watir and Ruby Based Test Automation System
 
Methodologies for Test-Driven Development of OSGi enabled Embedded Devices - ...
Methodologies for Test-Driven Development of OSGi enabled Embedded Devices - ...Methodologies for Test-Driven Development of OSGi enabled Embedded Devices - ...
Methodologies for Test-Driven Development of OSGi enabled Embedded Devices - ...
 
Fitnesse user acceptance test - Presentation
Fitnesse   user acceptance test - PresentationFitnesse   user acceptance test - Presentation
Fitnesse user acceptance test - Presentation
 
FitNesse With Scala
FitNesse With ScalaFitNesse With Scala
FitNesse With Scala
 
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
 
Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)
Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)
Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)
 
FitNesse, An Introduction
FitNesse, An IntroductionFitNesse, An Introduction
FitNesse, An Introduction
 
Automatic web ui testing
Automatic web ui testingAutomatic web ui testing
Automatic web ui testing
 

Ähnlich wie Acceptance Test Driven Development

2 ivan pashko - fake it 'til you make it
2   ivan pashko - fake it 'til you make it2   ivan pashko - fake it 'til you make it
2 ivan pashko - fake it 'til you make itIevgenii Katsan
 
Building a powerful double entry accounting system
Building a powerful double entry accounting systemBuilding a powerful double entry accounting system
Building a powerful double entry accounting systemLucas Cavalcanti dos Santos
 
INVEST in good user stories
INVEST in good user storiesINVEST in good user stories
INVEST in good user storiesSushant Tarway
 
Invoicing Gem - Sales & Payments In Your App
Invoicing Gem - Sales & Payments In Your AppInvoicing Gem - Sales & Payments In Your App
Invoicing Gem - Sales & Payments In Your AppMartin Kleppmann
 
Agile Acceptance Criteria How To
Agile Acceptance Criteria How ToAgile Acceptance Criteria How To
Agile Acceptance Criteria How ToPayton Consulting
 
Growing software from examples
Growing software from examplesGrowing software from examples
Growing software from examplesSeb Rose
 
Oracle R12 AR Enhancement Overview
Oracle R12 AR Enhancement OverviewOracle R12 AR Enhancement Overview
Oracle R12 AR Enhancement OverviewSanjay Challagundla
 
R12arreceivablesenhancement overview-091012183224-phpapp02
R12arreceivablesenhancement overview-091012183224-phpapp02R12arreceivablesenhancement overview-091012183224-phpapp02
R12arreceivablesenhancement overview-091012183224-phpapp02Monis Khan
 
Fake it til you make it. Ivan Pashko
Fake it til you make it. Ivan PashkoFake it til you make it. Ivan Pashko
Fake it til you make it. Ivan PashkoIevgenii Katsan
 
New Solutions for Managing Cash Flow Transworld Systems 09/12
New Solutions for  Managing Cash Flow Transworld Systems 09/12New Solutions for  Managing Cash Flow Transworld Systems 09/12
New Solutions for Managing Cash Flow Transworld Systems 09/12Wolfgang Kovacek
 
Eva for performance
Eva for performanceEva for performance
Eva for performanceSandip De
 
Zen and the Art of Automated Acceptance Test Suite Maintenance
Zen and the Art of Automated Acceptance Test Suite MaintenanceZen and the Art of Automated Acceptance Test Suite Maintenance
Zen and the Art of Automated Acceptance Test Suite MaintenanceJohn Ferguson Smart Limited
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented ProgrammingRAJU MAKWANA
 
Financial documnet
Financial documnetFinancial documnet
Financial documnetVijay Kumar
 
Cash Receipts in SAP ERP
Cash Receipts in SAP ERPCash Receipts in SAP ERP
Cash Receipts in SAP ERPBill Hanna, CPA
 
Behavior Driven Development [10] - Software Testing Techniques (CIS640)
Behavior Driven Development [10] - Software Testing Techniques (CIS640)Behavior Driven Development [10] - Software Testing Techniques (CIS640)
Behavior Driven Development [10] - Software Testing Techniques (CIS640)Venkatesh Prasad Ranganath
 
Invoicing app on ribily
Invoicing app on ribilyInvoicing app on ribily
Invoicing app on ribilyRibily
 

Ähnlich wie Acceptance Test Driven Development (20)

2 ivan pashko - fake it 'til you make it
2   ivan pashko - fake it 'til you make it2   ivan pashko - fake it 'til you make it
2 ivan pashko - fake it 'til you make it
 
Building a powerful double entry accounting system
Building a powerful double entry accounting systemBuilding a powerful double entry accounting system
Building a powerful double entry accounting system
 
INVEST in good user stories
INVEST in good user storiesINVEST in good user stories
INVEST in good user stories
 
Invoicing Gem - Sales & Payments In Your App
Invoicing Gem - Sales & Payments In Your AppInvoicing Gem - Sales & Payments In Your App
Invoicing Gem - Sales & Payments In Your App
 
Checks Collection Solution
Checks Collection SolutionChecks Collection Solution
Checks Collection Solution
 
Agile Acceptance Criteria How To
Agile Acceptance Criteria How ToAgile Acceptance Criteria How To
Agile Acceptance Criteria How To
 
Growing software from examples
Growing software from examplesGrowing software from examples
Growing software from examples
 
Defining tasks for User Stories
Defining tasks for User StoriesDefining tasks for User Stories
Defining tasks for User Stories
 
Oracle R12 AR Enhancement Overview
Oracle R12 AR Enhancement OverviewOracle R12 AR Enhancement Overview
Oracle R12 AR Enhancement Overview
 
R12arreceivablesenhancement overview-091012183224-phpapp02
R12arreceivablesenhancement overview-091012183224-phpapp02R12arreceivablesenhancement overview-091012183224-phpapp02
R12arreceivablesenhancement overview-091012183224-phpapp02
 
Fake it til you make it. Ivan Pashko
Fake it til you make it. Ivan PashkoFake it til you make it. Ivan Pashko
Fake it til you make it. Ivan Pashko
 
New Solutions for Managing Cash Flow Transworld Systems 09/12
New Solutions for  Managing Cash Flow Transworld Systems 09/12New Solutions for  Managing Cash Flow Transworld Systems 09/12
New Solutions for Managing Cash Flow Transworld Systems 09/12
 
My Portfolio
My PortfolioMy Portfolio
My Portfolio
 
Eva for performance
Eva for performanceEva for performance
Eva for performance
 
Zen and the Art of Automated Acceptance Test Suite Maintenance
Zen and the Art of Automated Acceptance Test Suite MaintenanceZen and the Art of Automated Acceptance Test Suite Maintenance
Zen and the Art of Automated Acceptance Test Suite Maintenance
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
Financial documnet
Financial documnetFinancial documnet
Financial documnet
 
Cash Receipts in SAP ERP
Cash Receipts in SAP ERPCash Receipts in SAP ERP
Cash Receipts in SAP ERP
 
Behavior Driven Development [10] - Software Testing Techniques (CIS640)
Behavior Driven Development [10] - Software Testing Techniques (CIS640)Behavior Driven Development [10] - Software Testing Techniques (CIS640)
Behavior Driven Development [10] - Software Testing Techniques (CIS640)
 
Invoicing app on ribily
Invoicing app on ribilyInvoicing app on ribily
Invoicing app on ribily
 

Mehr von John Ferguson Smart Limited

My Reading Specs - Refactoring Patterns for Gherkin Scenarios
My Reading Specs - Refactoring Patterns for Gherkin ScenariosMy Reading Specs - Refactoring Patterns for Gherkin Scenarios
My Reading Specs - Refactoring Patterns for Gherkin ScenariosJohn Ferguson Smart Limited
 
Artisti e Condotierri - How can your team become artists of the 21st century ...
Artisti e Condotierri - How can your team become artists of the 21st century ...Artisti e Condotierri - How can your team become artists of the 21st century ...
Artisti e Condotierri - How can your team become artists of the 21st century ...John Ferguson Smart Limited
 
Engage! Bringing teams together to deliver software that makes a difference
Engage! Bringing teams together to deliver software that makes a differenceEngage! Bringing teams together to deliver software that makes a difference
Engage! Bringing teams together to deliver software that makes a differenceJohn Ferguson Smart Limited
 
Sustainable Test Automation with Serenity BDD and Screenplay
Sustainable Test Automation with Serenity BDD and ScreenplaySustainable Test Automation with Serenity BDD and Screenplay
Sustainable Test Automation with Serenity BDD and ScreenplayJohn Ferguson Smart Limited
 
Engage! Bringing teams together to deliver software that makes a difference
Engage! Bringing teams together to deliver software that makes a differenceEngage! Bringing teams together to deliver software that makes a difference
Engage! Bringing teams together to deliver software that makes a differenceJohn Ferguson Smart Limited
 
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...John Ferguson Smart Limited
 
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...John Ferguson Smart Limited
 
Screenplay - Next generation automated acceptance testing
Screenplay - Next generation automated acceptance testingScreenplay - Next generation automated acceptance testing
Screenplay - Next generation automated acceptance testingJohn Ferguson Smart Limited
 
All the world's a stage – the next step in automated testing practices
All the world's a stage – the next step in automated testing practicesAll the world's a stage – the next step in automated testing practices
All the world's a stage – the next step in automated testing practicesJohn Ferguson Smart Limited
 
It's Testing, Jim, but not as we know it - BDD for Testers
It's Testing, Jim, but not as we know it - BDD for TestersIt's Testing, Jim, but not as we know it - BDD for Testers
It's Testing, Jim, but not as we know it - BDD for TestersJohn Ferguson Smart Limited
 

Mehr von John Ferguson Smart Limited (20)

My Reading Specs - Refactoring Patterns for Gherkin Scenarios
My Reading Specs - Refactoring Patterns for Gherkin ScenariosMy Reading Specs - Refactoring Patterns for Gherkin Scenarios
My Reading Specs - Refactoring Patterns for Gherkin Scenarios
 
Artisti e Condotierri - How can your team become artists of the 21st century ...
Artisti e Condotierri - How can your team become artists of the 21st century ...Artisti e Condotierri - How can your team become artists of the 21st century ...
Artisti e Condotierri - How can your team become artists of the 21st century ...
 
Engage! Bringing teams together to deliver software that makes a difference
Engage! Bringing teams together to deliver software that makes a differenceEngage! Bringing teams together to deliver software that makes a difference
Engage! Bringing teams together to deliver software that makes a difference
 
BE A POD OF DOLPHINS, NOT A DANCING ELEPHANT
BE A POD OF DOLPHINS, NOT A DANCING ELEPHANTBE A POD OF DOLPHINS, NOT A DANCING ELEPHANT
BE A POD OF DOLPHINS, NOT A DANCING ELEPHANT
 
Sustainable Test Automation with Serenity BDD and Screenplay
Sustainable Test Automation with Serenity BDD and ScreenplaySustainable Test Automation with Serenity BDD and Screenplay
Sustainable Test Automation with Serenity BDD and Screenplay
 
Feature Mapping Workshop
Feature Mapping WorkshopFeature Mapping Workshop
Feature Mapping Workshop
 
Engage! Bringing teams together to deliver software that makes a difference
Engage! Bringing teams together to deliver software that makes a differenceEngage! Bringing teams together to deliver software that makes a difference
Engage! Bringing teams together to deliver software that makes a difference
 
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...
 
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...
 
Shift left-devoxx-pl
Shift left-devoxx-plShift left-devoxx-pl
Shift left-devoxx-pl
 
Screenplay - Next generation automated acceptance testing
Screenplay - Next generation automated acceptance testingScreenplay - Next generation automated acceptance testing
Screenplay - Next generation automated acceptance testing
 
Cucumber and Spock Primer
Cucumber and Spock PrimerCucumber and Spock Primer
Cucumber and Spock Primer
 
All the world's a stage – the next step in automated testing practices
All the world's a stage – the next step in automated testing practicesAll the world's a stage – the next step in automated testing practices
All the world's a stage – the next step in automated testing practices
 
CukeUp 2016 Agile Product Planning Workshop
CukeUp 2016 Agile Product Planning WorkshopCukeUp 2016 Agile Product Planning Workshop
CukeUp 2016 Agile Product Planning Workshop
 
BDD Anti-patterns
BDD Anti-patternsBDD Anti-patterns
BDD Anti-patterns
 
Serenity and the Journey Pattern
Serenity and the Journey PatternSerenity and the Journey Pattern
Serenity and the Journey Pattern
 
BDD - Collaborate like you mean it!
BDD - Collaborate like you mean it!BDD - Collaborate like you mean it!
BDD - Collaborate like you mean it!
 
BDD-Driven Microservices
BDD-Driven MicroservicesBDD-Driven Microservices
BDD-Driven Microservices
 
BDD Anti-patterns
BDD Anti-patternsBDD Anti-patterns
BDD Anti-patterns
 
It's Testing, Jim, but not as we know it - BDD for Testers
It's Testing, Jim, but not as we know it - BDD for TestersIt's Testing, Jim, but not as we know it - BDD for Testers
It's Testing, Jim, but not as we know it - BDD for Testers
 

Kürzlich hochgeladen

Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 

Kürzlich hochgeladen (20)

Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 

Acceptance Test Driven Development

  • 1. Acceptance Test Driven Development Bringing Testers and Developers Together John Ferguson Smart Wakaleo Consulting Ltd. http://www.wakaleo.com Email: john.smart@wakaleo.com Twitter: wakaleo
  • 2. Introduction So what’s this talk about, anyway Acceptance tests as a communication tool Acceptance Test Driven Development BDD-style Acceptance Tests - easyb
  • 3. Acceptance Tests Acceptance Tests - a key Agile practice A communication tool Owned by the customer Determine when a feature is ‘done’ Written together (customer, developer, tester) Focus on What, not How
  • 4. Acceptance Tests Acceptance Tests - how far do you go? In depth tests or examples of system usage? Exhaustive Tests or Sample Stories?
  • 5. Acceptance Tests Acceptance Tests - a key Agile practice User Story 1 - Transfer funds User Story 11- -Calculate my tax rate User Story Calculate my tax rate As a bank client, I want to transfer funds from my current account to my savings account, so As a tax payer, I want to be able to calculate my that I a taxearn more interest able to calculate my As can payer, I want to be tax online, so that I can put enough money aside. tax online, so that I can put enough money aside. So how do we know when this feature is done?
  • 6. Acceptance Tests Acceptance Tests - a key Agile practice User Story 11- ---Acceptance Testsrate User Story 11Calculate my tax User Story Transfer funds User Story Calculate my tax rate - As a bank client,money between two accounts from Client can transfer I want to transfer funds - my current account to my savings account, so Client can’t transfer negative amount - Client can’t transfer wantthan currentto calculate my As a tax payer, I more to be able account balance that I a taxearn more interest able to calculate my As can payer, I want to be - Client can’t transfer from a blocked accountmoney aside. tax online, so that I can put enough tax online, so that I can put enough money aside. So how do we know when this feature is done? Let’s write some Acceptance Criteria
  • 7. Acceptance Tests Acceptance Criteria Conditions that must be met before the story is complete Provided by the customer Some folks use a more formal notation How do I get my tests? Just add some examples! User Story 1 - Acceptance Tests - Client can transfer money between two accounts - Client can’t transfer negative amount - Client can’t transfer more than current account balance - Client can’t transfer from a blocked account
  • 8. Acceptance Test-Driven Development Acceptance Tests drive work during the iteration Pick a story card Write the acceptance tests Automate the acceptance tests Implement the user story Iteration n-1 Iteration n Iteration n+1
  • 9. Acceptance Test-Driven Development Implementing/Automating the Acceptance Tests Acceptance Tests become ‘executable’ Focus is still on communication You don’t need to use the same language as the application
  • 10. Tools for the job What tools exist? Two main approaches Narrative easyb, JBehave, rspec, Cucumber,... Table-based Fitnesse,...
  • 11. Introducing easyb So what is easyb, anyway? A BDD testing framework for Java Make testing clearer and easier to write Make tests self-documenting Help developers focus on the requirements Based on Groovy Java-like syntax Quick to write Full access to Java classes and APIs Well-suited to Acceptance Tests BDD Acceptance Testing
  • 12. Easyb in Action Easyb supports Specifications and Stories Specifications express requirements as simple statements Stories use the “given-when-then” approach
  • 13. Easyb Specifications Writing Easyb Specifications Simple and informal Easy to write Very similar to acceptance criteria
  • 14. Easyb Specifications Writing Easyb Specifications User Story 1 - Acceptance Tests - Client can transfer money between two accounts - Client can’t transfer negative amount - Client can’t transfer more than current account balance - Client can’t transfer from a blocked account Start off with our acceptance criteria AccountTransfer.specifications description "A client should be able to transfer money between accounts" it "should let a client transfer money from a current to a savings a/c" it "should not allow a client to transfer a negative amount" it "should not allow a client to transfer more than the current balance" it "should not allow a client to transfer from a blocked account" Express these in Easyb
  • 15. Easyb Specifications Writing Easyb Specifications Executable Requirements description "A client should be able to transfer money between accounts" it "should let a client transfer money from a current to a savings a/c" it "should not allow a client to transfer a negative amount" it "should not allow a client to transfer more than the current balance" it "should not allow a client to transfer from a blocked account" This code will run! The tests are marked as ‘PENDING’
  • 16. Easyb Specifications Writing Easyb Specifications HTML Progress reports
  • 17. Easyb Specifications Writing Easyb Specifications Implementing the tests package com.wakaleo.accounts.domain description "A client should be able to transfer money between accounts" it "should let a client transfer money from a current to a savings a/c", { current = new Account(200) savings = new Account(300) A developer implements the test in Groovy current.transferTo(savings, 50) savings.balance.shouldBe 350 current.balance.shouldBe 150 } it "should not allow a client to transfer a negative amount" it "should not allow a client to transfer more than the current balance" it "should not allow a client to transfer from a blocked account" No longer pending Still pending...
  • 18. Easyb Stories Writing Easyb Stories Use a narrative approach Describe a precise requirement Can be understood by a stakeholder Usually made up of a set of scenarios Use an easy-to-understand structure: Given [a context]... When [something happens]... Then [something else happens]...
  • 19. Easyb Stories Building an easyb story A story is made up of scenarios Scenarios validate specific behaviour User Story 1 - Acceptance Tests - Client can transfer money between two accounts - Client can’t transfer negative amount - Client can’t transfer more than current account balance - Client can’t transfer from a blocked account AccountTransfer.story scenario "A client can transfer money from a current to a savings a/c" scenario "A client is not allowed to transfer a negative amount" scenario "A client is not allowed to transfer more than the current balance" scenario "A client is not allowed to transfer from a blocked account"
  • 20. Easyb Stories Anatomy of an easyb story scenario "A client can transfer money from a current to a savings a/c", { given 'a current a/c with $200 and a savings a/c with $300' when 'you transfer $50 from the current a/c to the savings a/c' then 'the savings a/c should have $350 and the current a/c $150' } “Scenario”: corresponds to precise requirement “Given”: the context in which this requirement applies “When”: An event or action “Then”: The expected results of this action
  • 21. Easyb Stories Implementing the scenario package com.wakaleo.accounts.domain scenario "A client can transfer money from a current to a savings a/c", { given 'a current a/c with $200 and a savings a/c with $300', { current = new Account(200) savings = new Account(300) } when 'you transfer $50 from the current a/c to the savings a/c', { current.transferTo(savings, 50) } then 'the savings a/c should have $350 and the current a/c $150', { savings.balance.shouldBe 350 current.balance.shouldBe 150 } } scenario "A client is not allowed to transfer a negative amount" scenario "A client is not allowed to transfer more than the current balance" scenario "A client is not allowed to transfer from a blocked account"
  • 22. Easyb Stories Implementing the scenario - an alternative solution package com.wakaleo.accounts.domain scenario "A client can transfer money from a current to a savings a/c", { given 'a current a/c with $200', { current = new Account(200) Using ‘and’ for more clarity } and 'a savings a/c with $300', { savings = new Account(300) } when 'you transfer $50 from the current a/c to the savings a/c', { current.transferTo(savings, 50) } then 'the savings a/c should have $350', { savings.balance.shouldBe 350 } and 'the current a/c should have $150', { current.balance.shouldBe 150 } } scenario "A client is not allowed to transfer a negative amount" scenario "A client is not allowed to transfer more than the current balance" scenario "A client is not allowed to transfer from a blocked account"
  • 23. Easyb assertions Ensuring what should be The shouldBe syntax: Intuitive, readable and flexible account.balance.shouldBe initialAmount Comes in many flavors account.balance.shouldBeEqualTo initialAmount account.balance.shouldNotBe 0 account.balance.shouldBeGreaterThan 0 account.shouldHave(balance:initialAmount)
  • 24. Easyb Stories Implementing another scenario - error conditions package com.wakaleo.accounts.domain scenario "A client can transfer money from a current to a savings a/c", { ... } scenario "A client is not allowed to transfer a negative amount", { given 'a current a/c with $200', { current = new Account(200) } and 'a savings a/c with $300', { savings = new Account(300) } when "you try to transfer a negative amount", { Create a closure transferNegativeAmount = { representing this operation current.transferTo(savings, -50) } } then "an IllegalTransferException should be thrown", { ensureThrows(IllegalTransferException.class) { transferNegativeAmount() Fail if the exception is not } thrown } } scenario "A client is not allowed to transfer more than the current balance" scenario "A client is not allowed to transfer from a blocked account"
  • 25. Easyb fixtures Structuring your tests...fixtures in easyb Setting up the test environment... Similar to JUnit fixtures @Before and @BeforeClass before is run at the start of the whole story before_each is run before each scenario Useful for setting up databases, test servers, etc.
  • 26. Easyb fixtures Refactoring our scenarios - before and before_each before_each "setup the test accounts", { given 'a current a/c with $200', { current = new Account(200) This will be done before } and 'a savings a/c with $300', { each scenario savings = new Account(300) } } scenario "A client can transfer money from a current to a savings a/c", { when 'you transfer $50 from the current a/c to the savings a/c', { current.transferTo(savings, 50) } then 'the savings a/c should have $350 and the current a/c $150', { savings.balance.shouldBe 350 } and 'the current a/c should have $150', { current.balance.shouldBe 150 } } scenario "A client is not allowed to transfer a negative amount", { when "you try to transfer a negative amount", { transferNegativeAmount = { current.transferTo(savings, -50) } } then "an IllegalTransferException should be thrown", { ensureThrows(IllegalTransferException.class) { transferNegativeAmount() } } }
  • 27. Easyb fixtures Shared behaviour Refactor common code in easyb scenarios shared_behavior "shared behaviors", {   given "a string", {     var = "" Common behavior (‘shared_behavior’)   }   when "the string is hello world", {     var = "hello world"   } } scenario "first scenario", {   it_behaves_as "shared behaviors"     then "the string should start with hello", { Reused here (‘it_behaves_as’)...     var.shouldStartWith "hello"   } } scenario "second scenario", {   it_behaves_as "shared behaviors"     then "the string should end with world", { ...and here     var.shouldEndWith "world"   } }
  • 28. Web testing with easyb Easyb is convenient for web testing BDD/Functional tests Run against a test server, or use Jetty Use your choice of web testing frameworks Selenium JWebUnit ...
  • 29. Web testing with easyb Many options - let’s look at two Selenium Runs in a browser High-level API Runs slower and more work to set up JWebUnit Simulates a browser Runs faster, easy to set up API slightly lower level
  • 30. Web testing with easyb An example - writing functional tests with JWebUnit import net.sourceforge.jwebunit.junit.WebTester before_each "initialize a web test client", { Set up a JWebUnit client given "we have a web test client", { tester = new WebTester() tester.setBaseUrl("http://localhost:8080/tweeter-web") } } scenario "User signup should add a new user", { when "I click on the sign up button on the home page", { tester.beginAt("/home") Click on a link tester.clickLinkWithText("Sign up now!") } and "I enter a new username and password", { tester.setTextField("username", "jane") Enter some values tester.setTextField("password", "tiger") tester.submit() } then "the application should log me on as the new user and show a welcome message", { tester.assertTextPresent("Hi jane!") } Check the results }
  • 31. Easyb reports The easyb HTML report Test results summary Unimplemented stories Failed stories
  • 32. Easyb reports The easyb HTML report Test results summary Test failure details Unimplemented stories
  • 33. Other Approaches How does easyb compare with other tools? Cucumber, RSpec (Ruby) - very similar to easyb FitNesse - wikis and tables Concordion - marked-up HTML
  • 34. FitNesse FitNesse - wiki-based acceptance tests Test data is written at tables on a Wiki Java classes implement the tests behind the scenes
  • 35. FitNesse FitNesse - wiki-based acceptance tests Test data and scenarios as a table Test data Expected results
  • 36. FitNesse FitNesse - wiki-based acceptance tests Testers can write/edit the Wiki pages You can also import to and from Excel
  • 37. FitNesse FitNesse - wiki-based acceptance tests public class TransferMoneyBetweenAccounts { Tests are implemented by private BigDecimal savingsBalance; Java classes private BigDecimal currentBalance; private BigDecimal transfer; private BigDecimal finalSavingsBalance; Each column has a private BigDecimal finalCurrentBalance; private boolean exceptionThrown; field in the class public void setSavingsBalance(BigDecimal savingsBalance) {...} public void setCurrentBalance(BigDecimal currentBalance) {...} public void setTransfer(BigDecimal transfer) {...} public BigDecimal finalCurrentBalance() {...} Expected results have public BigDecimal finalSavingsBalance() {...} getters public boolean exceptionThrown() {...} public void execute() { Account currentAccount = new Account(currentBalance); Account savingsAccount = new Account(savingsBalance); exceptionThrown = false; try { currentAccount.transferTo(savingsAccount, transfer); Performing the test finalCurrentBalance = currentAccount.getBalance(); finalSavingsBalance = savingsAccount.getBalance(); } catch (IllegalTransferException e) { exceptionThrown = true; } }
  • 38. Commercial options? There are also some commercial tools out there... GreenPepper Supports tables and BDD-style Nice tool integration (Confluence, Maven,...) Twixt Thoughtworks product, focus on web testing Others?
  • 39. Thank You John Ferguson Smart Wakaleo Consulting Ltd. http://www.wakaleo.com Email: john.smart@wakaleo.com Twitter: wakaleo