patterns for scripted acceptance test-driven development
DESCRIPTION
introduces a series of related patterns to be used in an acceptance testdrivendevelopment (ATDD) approach to software development using scripts. ATDDuses executable client-readable acceptance tests written in the form of scripts as thekey analysis artifacts that guide software development and presents a number ofadvantages over traditional analysis artifacts – texts and diagrams. They include abetter bridging of communication gaps between clients and developers, prevention offeature creep and synchronization between analysis changes and the code beingwritten.TRANSCRIPT
![Page 1: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/1.jpg)
1
Patterns for ScriptedAcceptance Test-Driven
DevelopmentFang Liu
Ider ZhengPooja Gore
![Page 2: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/2.jpg)
2
Patterns for acceptance test-driven development (ATDD) using scripts
Approaches to cope with the challenges
Intent
![Page 3: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/3.jpg)
3
ATDD consists of
Script Languageso Allows control of one or more application
Business objectso manipulated by the program which make sense to the
cliento hidden to the client
Non-Business Objects
Context
![Page 4: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/4.jpg)
4
Client must understand and review the testso Should be imbued with a testing cultureo A learning curve is associated with the
approach
Problem
![Page 5: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/5.jpg)
Interrelated Patterns
![Page 6: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/6.jpg)
Test Creation Patterns
Test Flow Creator Destroyer
Limit Breaker
Command Errors
Table Tester
Workflow Tester
Template Tester
Persistence Tester
![Page 7: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/7.jpg)
To verify if a given software property results as expected after a given action
Test Flow
![Page 8: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/8.jpg)
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.
Three Steps for Test Flow
![Page 9: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/9.jpg)
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
Creator & Destroyer
![Page 10: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/10.jpg)
Steps for Construction
Check Object Not
Exist
• Otherwise, exception or do nothing
Create Object
Check Object Exist
• Otherwise, exception or go back creation step
Validate the
property of Object
![Page 11: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/11.jpg)
Steps for Destruction
Check Object Exist
• Otherwise, do nothing
Destroy Object
Check Object Not
Exist
• Otherwise, exception or go back destroy step
Validate double
Destruction
![Page 12: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/12.jpg)
To test a business object or program flow that has limits (ranges or sets of allowed values)
Limit Breaker
![Page 13: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/13.jpg)
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.
Limit Breaker
![Page 14: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/14.jpg)
Created a new command to incorporate in the script language and will start writing tests with it
Command Errors
![Page 15: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/15.jpg)
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
Command Errors
![Page 16: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/16.jpg)
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
![Page 17: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/17.jpg)
Table Tester
![Page 18: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/18.jpg)
Context Test a workflow
Problemo Tables become too verboseo Such tables make script understanding and maintenance
difficult
Forces
A workflow is sequential in nature
Solution Use commands in sequence instead of tables
Workflow Tester
![Page 19: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/19.jpg)
Context
Testing massive textual or non-textual content
Problemo Massive textual content makes a script unintelligibleo Non-textual content can only be included in a script through an IDE
Forces
Templates for test cases can be generated using software
Solutiono Divert the contents to be tested to outside the script o And use a template to compare it with
Related Patterns
Test Flow
Template Tester
![Page 20: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/20.jpg)
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
Solutiono The first part, add data in a programo The second part , check if data is retained
Related Patterns
Test Flow
Persistence Tester
![Page 21: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/21.jpg)
Build Summarize
r
Only Business Objects
Commentor
Test Organization Patterns
![Page 22: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/22.jpg)
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
Build Summarizer
![Page 23: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/23.jpg)
Context Tests include Non-business objects
Problem
Tests for non-business objects are unintelligible for the client
Forceso Client’s understanding of all Tests is importanto Testing non-business objects is equally important
Solutiono Test only business objects in an acceptance test scripto Test all Non-Business Objects with Unit Test
Only Business Objects
![Page 24: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/24.jpg)
Context
Developer fails to understand a designed test
Problemo Development stalls o A bug or wrong requirement may be introducedo Inconsistent Test Comments
Forces
Communicator between Client and Developer
Solutiono Use Commentso Update Comments
Commentor
![Page 25: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/25.jpg)
Client Assertion
TemplateGenerato
r
Test Application Patterns
![Page 26: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/26.jpg)
27
Contexto Find a potential wrong test
Problemo If bugs are changed by developers, feature creep will
emergeo If bugs are not found, clients disappointed
Forceso Clients must review tests
SolutionsNo test should be modified without the client’s consent
Client Assertion
![Page 27: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/27.jpg)
28
Context
Problemo Becomes harder to find test cases
Solution Exam the presented results
Template Generator
![Page 28: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/28.jpg)
Most widely known o FIT (Framework for Integrated Testing)
Otherso EasyAccepto Exactor
Testing tools
![Page 29: Patterns for Scripted Acceptance Test-Driven Development](https://reader033.vdocuments.site/reader033/viewer/2022052600/5586e51fd8b42a84798b45c2/html5/thumbnails/29.jpg)
30
THANK YOU!