SlideShare a Scribd company logo
1 of 29
Patterns for Scripted
Acceptance Test-Driven
    Development
         Fang Liu
        Ider Zheng
        Pooja Gore




            1
Intent



 Patterns for acceptance test-driven development
  (ATDD) using scripts

 Approaches to cope with the challenges




                          2
Context


ATDD consists of

 Script Languages
  o Allows control of one or more application

 Business objects
  o manipulated by the program which make sense to the client
  o hidden to the client

 Non-Business Objects

                               3
Problem



 Client must understand and review the tests
  o Should be imbued with a testing culture
  o A learning curve is associated with the approach




                             4
Interrelated Patterns
Test Creation Patterns

Test Flow    Creator   Destroyer


 Limit      Command      Table
Breaker       Errors     Tester

Workflow    Template   Persistence
 Tester      Tester      Tester
Test Flow



 To verify if a given software property results as
  expected after a given action
Three Steps for Test Flow


 Step 1:
  o Build a scenario you want to test

 Step 2:
  o Operate the program with the desired action

 Step 3:
  o Check the new program’s state.
Creator & Destroyer



 To test if a business object has been successfully
  created or removed in the program

 Business object creation and destruction are common
  operations in test scripts
Steps for Construction

  Check
Object Not   •Otherwise, exception
              or do nothing

  Exist


               Create
               Object



                                       Check         •Otherwise, exception
                                                      or go back creation
                                     Object Exist     step




                                                    Validate the
                                                    property of
                                                      Object
Steps for Destruction

  Check        •Otherwise, do
                nothing
Object Exist



                Destroy
                Object


                                  Check       •Otherwise, exception
                                Object Not     or go back destroy
                                               step
                                  Exist

                                              Validate
                                               double
                                             Destruction
Limit Breaker



 To test a business object or program flow that has
  limits (ranges or sets of allowed values)
Limit Breaker

 Always precisely demarcate limits by giving examples of
  inner and outer bounds.

 Make sure values immediately out of the bounds throw
  errors, and limit inbound values don't.

 In general, tests for the immediate limits are enough to
  indicate to the developer that further values aren’t
  acceptable, even if the tests don’t explicitly list all of them.
Command Errors



 Created a new command to incorporate in the script
  language and will start writing tests with it
Command Errors

 Test coverage is difficult to attain if you don’t approach testing
  systematically

 When thinking on a new command to add to the script
  language, you often think about tests that will involve this
  command, including anomalous uses;

 A system should be able to identify a misuse of one of its
  operations and may even give clues about the problem cause
Table Tester



 To test extensive lists of features for multiple business objects
  of the same kind, or multiple examples to test formulas
  (calculations)

 To declare business rules in a formulaic manner
Table Tester
Workflow Tester

 Context
        Test a workflow

 Problem
  o Tables become too verbose
  o Such tables make script understanding and maintenance difficult

 Forces
        A workflow is sequential in nature

 Solution
        Use commands in sequence instead of tables
Template Tester

 Context
        Testing massive textual or non-textual content
 Problem
  o Massive textual content makes a script unintelligible
  o Non-textual content can only be included in a script through an IDE
 Forces
        Templates for test cases can be generated using software
 Solution
  o Divert the contents to be tested to outside the script
  o And use a template to compare it with

 Related Patterns
        Test Flow
Persistence Tester

 Context
        Test if data entered in the program is persistent
 Problem
        Lack of a systematic approach to testing persistence
 Forces
        Setting up a scenario for persistence can often be reused
 Solution
  o The first part, add data in a program
  o The second part , check if data is retained
 Related Patterns
        Test Flow
Test Organization Patterns


     Build     Only Business
  Summarizer     Objects



         Commentor
Build Summarizer

 Context
        Similar test used frequently in a script

 Problem
        Repetition of the same test sequence, making script verbose

 Forces
      Commonly used sequence can be summarized in an expressive
  command

 Solution
        Set commonly used tests a separate single test sequence
Only Business Objects

 Context
        Tests include Non-business objects

 Problem
        Tests for non-business objects are unintelligible for the client

 Forces
  o Client’s understanding of all Tests is important
  o Testing non-business objects is equally important

 Solution
  o Test only business objects in an acceptance test script
  o Test all Non-Business Objects with Unit Test
Commentor

 Context
        Developer fails to understand a designed test

 Problem
  o Development stalls
  o A bug or wrong requirement may be introduced
  o Inconsistent Test Comments

 Forces
        Communicator between Client and Developer

 Solution
  o Use Comments
  o Update Comments
Test Application Patterns




 Client        Template
Assertion     Generator
Client Assertion

 Context
  o Find a potential wrong test
 Problem
  o If bugs are changed by developers, feature creep will emerge
  o If bugs are not found, clients disappointed
 Forces
  o Clients must review tests
 Solutions
   No test should be modified without the client’s consent


                                27
Template Generator


 Context

 Problem
  o Becomes harder to find test cases

 Solution
   Exam the presented results


                            28
Testing tools


 Most widely known
  o FIT (Framework for Integrated Testing)


 Others
  o EasyAccept
  o Exactor
THANK YOU!

    30

More Related Content

What's hot

Unit Testing Guidelines
Unit Testing GuidelinesUnit Testing Guidelines
Unit Testing Guidelines
Joel Hooks
 
Roy Osherove on Unit Testing Good Practices and Horrible Mistakes
Roy Osherove on Unit Testing Good Practices and Horrible MistakesRoy Osherove on Unit Testing Good Practices and Horrible Mistakes
Roy Osherove on Unit Testing Good Practices and Horrible Mistakes
Roy Osherove
 
Unit Testing And Mocking
Unit Testing And MockingUnit Testing And Mocking
Unit Testing And Mocking
Joe Wilson
 
Agile and ATDD the perfect couple
Agile and ATDD the perfect coupleAgile and ATDD the perfect couple
Agile and ATDD the perfect couple
Stephen Tucker
 
Benefit From Unit Testing In The Real World
Benefit From Unit Testing In The Real WorldBenefit From Unit Testing In The Real World
Benefit From Unit Testing In The Real World
Dror Helper
 
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
Zohirul Alam Tiemoon
 

What's hot (18)

Why Unit Testingl
Why Unit TestinglWhy Unit Testingl
Why Unit Testingl
 
Unit Testing Guidelines
Unit Testing GuidelinesUnit Testing Guidelines
Unit Testing Guidelines
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
Software Testing
Software TestingSoftware Testing
Software Testing
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
Software testing ... who’s responsible is it?
Software testing ... who’s responsible is it?Software testing ... who’s responsible is it?
Software testing ... who’s responsible is it?
 
TDD (Test Driven Design)
TDD (Test Driven Design)TDD (Test Driven Design)
TDD (Test Driven Design)
 
Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010
 
Unit tests & TDD
Unit tests & TDDUnit tests & TDD
Unit tests & TDD
 
UNIT TESTING
UNIT TESTINGUNIT TESTING
UNIT TESTING
 
Roy Osherove on Unit Testing Good Practices and Horrible Mistakes
Roy Osherove on Unit Testing Good Practices and Horrible MistakesRoy Osherove on Unit Testing Good Practices and Horrible Mistakes
Roy Osherove on Unit Testing Good Practices and Horrible Mistakes
 
Unit Testing And Mocking
Unit Testing And MockingUnit Testing And Mocking
Unit Testing And Mocking
 
Agile and ATDD the perfect couple
Agile and ATDD the perfect coupleAgile and ATDD the perfect couple
Agile and ATDD the perfect couple
 
Benefit From Unit Testing In The Real World
Benefit From Unit Testing In The Real WorldBenefit From Unit Testing In The Real World
Benefit From Unit Testing In The Real World
 
Unit testing
Unit testingUnit testing
Unit testing
 
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
 
Understanding Unit Testing
Understanding Unit TestingUnderstanding Unit Testing
Understanding Unit Testing
 
Unit test
Unit testUnit test
Unit test
 

Similar to Patterns for Scripted Acceptance Test-Driven Development

Implementing Test Automation in Agile Projects
Implementing Test Automation in Agile ProjectsImplementing Test Automation in Agile Projects
Implementing Test Automation in Agile Projects
Michael Palotas
 
Keyword Driven Testing
Keyword Driven TestingKeyword Driven Testing
Keyword Driven Testing
Maveryx
 
Tester Challenges in Agile ?
Tester Challenges in Agile ?Tester Challenges in Agile ?
Tester Challenges in Agile ?
alind tiwari
 

Similar to Patterns for Scripted Acceptance Test-Driven Development (20)

test
testtest
test
 
test
testtest
test
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Writing useful automated tests for the single page applications you build
Writing useful automated tests for the single page applications you buildWriting useful automated tests for the single page applications you build
Writing useful automated tests for the single page applications you build
 
Software testing ... who is responsible for it?
Software testing ... who is responsible for it?Software testing ... who is responsible for it?
Software testing ... who is responsible for it?
 
Unit Testing in Swift
Unit Testing in SwiftUnit Testing in Swift
Unit Testing in Swift
 
Implementing Test Automation in Agile Projects
Implementing Test Automation in Agile ProjectsImplementing Test Automation in Agile Projects
Implementing Test Automation in Agile Projects
 
Agile Testing 20021015
Agile Testing 20021015Agile Testing 20021015
Agile Testing 20021015
 
Types of testing
Types of testingTypes of testing
Types of testing
 
Software testing ppt
Software testing pptSoftware testing ppt
Software testing ppt
 
Implementing Test Automation in Agile Projects
Implementing Test Automation in Agile ProjectsImplementing Test Automation in Agile Projects
Implementing Test Automation in Agile Projects
 
Testing and Mocking Object - The Art of Mocking.
Testing and Mocking Object - The Art of Mocking.Testing and Mocking Object - The Art of Mocking.
Testing and Mocking Object - The Art of Mocking.
 
Keyword Driven Testing
Keyword Driven TestingKeyword Driven Testing
Keyword Driven Testing
 
JavaScript Unit Testing
JavaScript Unit TestingJavaScript Unit Testing
JavaScript Unit Testing
 
Database Unit Testing Made Easy with VSTS
Database Unit Testing Made Easy with VSTSDatabase Unit Testing Made Easy with VSTS
Database Unit Testing Made Easy with VSTS
 
Tester Challenges in Agile ?
Tester Challenges in Agile ?Tester Challenges in Agile ?
Tester Challenges in Agile ?
 
Agile process
Agile processAgile process
Agile process
 
Making the Unstable Stable - An Intro To Testing
Making the Unstable Stable - An Intro To TestingMaking the Unstable Stable - An Intro To Testing
Making the Unstable Stable - An Intro To Testing
 
Unit testing & TDD concepts with best practice guidelines.
Unit testing & TDD concepts with best practice guidelines.Unit testing & TDD concepts with best practice guidelines.
Unit testing & TDD concepts with best practice guidelines.
 
Agile Software Development in Practice - A Developer Perspective
Agile Software Development in Practice - A Developer PerspectiveAgile Software Development in Practice - A Developer Perspective
Agile Software Development in Practice - A Developer Perspective
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Recently uploaded (20)

Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 

Patterns for Scripted Acceptance Test-Driven Development

  • 1. Patterns for Scripted Acceptance Test-Driven Development Fang Liu Ider Zheng Pooja Gore 1
  • 2. Intent  Patterns for acceptance test-driven development (ATDD) using scripts  Approaches to cope with the challenges 2
  • 3. Context ATDD consists of  Script Languages o Allows control of one or more application  Business objects o manipulated by the program which make sense to the client o hidden to the client  Non-Business Objects 3
  • 4. Problem  Client must understand and review the tests o Should be imbued with a testing culture o A learning curve is associated with the approach 4
  • 6. Test Creation Patterns Test Flow Creator Destroyer Limit Command Table Breaker Errors Tester Workflow Template Persistence Tester Tester Tester
  • 7. Test Flow  To verify if a given software property results as expected after a given action
  • 8. Three Steps for Test Flow  Step 1: o Build a scenario you want to test  Step 2: o Operate the program with the desired action  Step 3: o Check the new program’s state.
  • 9. Creator & Destroyer  To test if a business object has been successfully created or removed in the program  Business object creation and destruction are common operations in test scripts
  • 10. Steps for Construction Check Object Not •Otherwise, exception or do nothing Exist Create Object Check •Otherwise, exception or go back creation Object Exist step Validate the property of Object
  • 11. Steps for Destruction Check •Otherwise, do nothing Object Exist Destroy Object Check •Otherwise, exception Object Not or go back destroy step Exist Validate double Destruction
  • 12. Limit Breaker  To test a business object or program flow that has limits (ranges or sets of allowed values)
  • 13. Limit Breaker  Always precisely demarcate limits by giving examples of inner and outer bounds.  Make sure values immediately out of the bounds throw errors, and limit inbound values don't.  In general, tests for the immediate limits are enough to indicate to the developer that further values aren’t acceptable, even if the tests don’t explicitly list all of them.
  • 14. Command Errors  Created a new command to incorporate in the script language and will start writing tests with it
  • 15. Command Errors  Test coverage is difficult to attain if you don’t approach testing systematically  When thinking on a new command to add to the script language, you often think about tests that will involve this command, including anomalous uses;  A system should be able to identify a misuse of one of its operations and may even give clues about the problem cause
  • 16. Table Tester  To test extensive lists of features for multiple business objects of the same kind, or multiple examples to test formulas (calculations)  To declare business rules in a formulaic manner
  • 18. Workflow Tester  Context Test a workflow  Problem o Tables become too verbose o Such tables make script understanding and maintenance difficult  Forces A workflow is sequential in nature  Solution Use commands in sequence instead of tables
  • 19. Template Tester  Context Testing massive textual or non-textual content  Problem o Massive textual content makes a script unintelligible o Non-textual content can only be included in a script through an IDE  Forces Templates for test cases can be generated using software  Solution o Divert the contents to be tested to outside the script o And use a template to compare it with  Related Patterns Test Flow
  • 20. Persistence Tester  Context Test if data entered in the program is persistent  Problem Lack of a systematic approach to testing persistence  Forces Setting up a scenario for persistence can often be reused  Solution o The first part, add data in a program o The second part , check if data is retained  Related Patterns Test Flow
  • 21. Test Organization Patterns Build Only Business Summarizer Objects Commentor
  • 22. Build Summarizer  Context Similar test used frequently in a script  Problem Repetition of the same test sequence, making script verbose  Forces Commonly used sequence can be summarized in an expressive command  Solution Set commonly used tests a separate single test sequence
  • 23. Only Business Objects  Context Tests include Non-business objects  Problem Tests for non-business objects are unintelligible for the client  Forces o Client’s understanding of all Tests is important o Testing non-business objects is equally important  Solution o Test only business objects in an acceptance test script o Test all Non-Business Objects with Unit Test
  • 24. Commentor  Context Developer fails to understand a designed test  Problem o Development stalls o A bug or wrong requirement may be introduced o Inconsistent Test Comments  Forces Communicator between Client and Developer  Solution o Use Comments o Update Comments
  • 25. Test Application Patterns Client Template Assertion Generator
  • 26. Client Assertion  Context o Find a potential wrong test  Problem o If bugs are changed by developers, feature creep will emerge o If bugs are not found, clients disappointed  Forces o Clients must review tests  Solutions  No test should be modified without the client’s consent 27
  • 27. Template Generator  Context  Problem o Becomes harder to find test cases  Solution  Exam the presented results 28
  • 28. Testing tools  Most widely known o FIT (Framework for Integrated Testing)  Others o EasyAccept o Exactor

Editor's Notes

  1. Example:In a Monopoly game, you need to test if a player is thrown out of the game afterfalling on a series of tax places and taking a series of actions that decrease hismoney. If you use tables, you will need a separate table for every command you use.
  2. Example:generateReport output="report.txt"# equalFiles is a command in EasyAccept that tests if# two files have the exact same contentequalFiles templates\\reportTemplate.txt report.txt
  3. Example:# creating an employee - script1.txtclearEmployeeDatabaseexpecterror "employee doesn't exist" getEmployeeSalary \\employeeName="John Doe"createEmployeeemployeeName="John Doe" salary=1500expect 1500 getEmployeeSalaryemployeeName="John Doe"saveEverythingAndCloseProgram# restart is an EasyAccept commandrestart# checking persistenceexpect 1500 getEmployeeSalaryemployeeName="John Doe"
  4. # script 1executeScript sampleDatabaseSetup.txt… and then do the tests you want# script 2executeScript sampleDatabaseSetup.txt… and then do a number of different tests
  5. # the tests below should be unit testsexpect 25 getBQueueNodeFatherIndexexpectError “Code #432653: unexpected fault for the middleware connection”getCORBASkeletonMiddlwareProperty