验收测试驱动开发实战
合集下载
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Change
Use existing acceptance tests to discuss future changes Seek advices from customer to determine if it specifies obsolete functionality when test fails Automate periodic execution of regression tests with CI Keep tests in the same version control as code
Keyword argume
Argument demo mode
DataData-driven test cases
Define a keyword which will take the input data and prepare a table with test cases
Test case organisation
Select a set of these examples to be a specification and an acceptance test suite Automate the verification of acceptance tests Focus the software development effort on the acceptance tests
Real-world examples to build a shared understanding of the Realdomain
Use the set of acceptance tests to facilitate discussion abou future change requests.
Test case tagging
Simple way: Single HTML file containing all test case
Execution
Gathering test cases, reading and setting variables Executing all actions for every test case Providing global statistics Writing the output in XML format Generating report and log in HTML format
验收测试驱动开发实战 Acceptance Test Driven Development in practice
Steven Mak 麥天志 teven@oddteven@odd-e.com
What are we up to now?
Lost in translation Do not explain why Gaps discovered only until coding started Cumulative effects of small misunderstandings Inadequate and essentially flawed requirements and specifications
Sample execution result
Sample Test Report
in HTML format, showing all actions executed up to the failing action, with fail message
Tested application Interface
The ATDD cycle
coding testing
A-TDD architecture Worksho customer documentation p other activities
velopers Testers uct Owner rchitect nical writers
Example tests
Requiremen t Acceptance Test Feedback Implementat ion
Drive implementation of a requirement through a set of automated, executable acceptance tests
ATDD in a Nutshell
Some considerations
User Interface
Easy? Fragile? Performance issues?
Boundary of Stub
Sufficiently close Simulators?
Business logic
Not from developer perspective
Tools
Table-based frameworks TableFIT, http://fit.c2.com RobotFramework, http://robotframework.org
TextText-based frameworks
Exactor, http://exactor.sourceforge.net TextTest, http://texttest.carmen.se
Examples, Tests, and Spec
can become
Specification workshop
Ask the domain experts Developers and testers should suggest examples of edges or important issues for discussion Ubiquitous language Organise feedback to ensure shared understanding Use facilitator to stay focused if needed
Benefits of ATDD
Comprehensible examples over complex formulas Close Collaboration Definition of Done Co-operative Work CoTrust and Commitment Testing on system level
Variations - an escape?
Behaviour-driven development BehaviourExampleExample-driven development Executable specifications
Names do not matter, but underlying practices matte Worthwhile to try if your business people do not like “testing”
Acceptance criteria
Write tests collaboratively Examples in a form close to what your automation tool can understand Keep tests in a form that is human-readable humanSpecification over Scripting, describe WHAT, not how Acceptance tests to prevent defects, not to discover Not necessarily automate anything Acceptance tests only work when we can discuss them
Acceptance Test smells
Long tests Parameters of calculation tests that always have the same value Similar test with minor differences Tests that reflect the way code was written Tests fail intermittently even though you didn’t change any code Interdependent tests, e.g. setup for others
deal candidate to work with
Shared interest in success Authority to make decision Ability to understand implications Ability to explain the domain
Specification by Examples
Preparing Test cases
Test procedure using keywords
t case name
Test Case Valid Login Action Open Login Page Input Name Input Password Submit Credentials
FIT in practice
Test doc with tables Customer writes a test document containing examples Technical staff enhance the tables in the doc
Test doc w sanitised tables Executable Test Technical staff implements fixture classes Test doc and backing code
FIT
FIT stands for “Framework for Integrated Tests” “F Most popular framework in-use inTableTable-based
Supporting languages like Java, C#, Python, or Ruby
Robot Framework
Python-based Keyword-driven test automation PythonKeywordframework Test libraries implemented either in Python or Java Test cases are written in tabular format, save in HTML or TSV files Syntax similar to natural language Users can create new keywords from existing ones and contribute to the project
Failing to meet actual needs
are obvious things really obvious? Fulfilling specifications does not guarantee success Imperative requirements
Meeting the needs with Acceptance TDD
Use realistic examples to demonstrate differences in possibilities instead of abstract requirements Write specifications down as tables Workflows: Preconditions Processing steps Verifications
Command line OperatingSystem SSHLibraห้องสมุดไป่ตู้y Telnet library Web Robot Selenium GUI Swing GUI library