Do you find yourself with limited influence over what gets shipped on products you test? Is your report card on product quality often ignored? Do you think you can contribute more? Join Gerard Meszaros as he describes ways to transition from approaching quality with brute force testing to an enlightened and strategic perspective that will have real impact on product quality. Instead of criticizing the product, become an integral part of the development process and learn how you can help define what should be built. Gerard explores design for testability concepts and describes key testability requirements that will afford better, more efficient testing. He explains test design techniques that describe software functionality in layers of plain language tests. Gerard shows how a collaborative approach for building the right product results in much better outcomes from both quality and schedule perspectives. Stop rushing through multiple test-and-fix cycles that result in a less than quality product. Be part of the solution!
2. !
!
!
!
!!!!! !
!!!!
An independent software development consultant and trainer, Gerard Meszaros has
more than thirty years of experience in software and more than a decade of experience
in agile methods. Gerard is an expert in test automation patterns, refactoring of software
and tests, and design for testability. He has applied automated unit and acceptance
testing on projects ranging from full-on eXtreme Programming to traditional waterfall
development in a wide range of industries. Gerard is an expert in the implementation
and customization of agile methods such as Scrum, lean, and eXtreme Programming.
His book xUnit Test Patterns—Refactoring Test Code won a Jolt Productivity Award in
the Best Technical Book category.
Gerard Meszaros
Independent Consultant
3. 1
1 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Build the Right Product Right
Transitioning Test from Critiquing to Defining
Gerard Meszaros
Independent Consultant
CTO of FeedXL.Com
StarCanada2015@gerardm.com
These slides: http://StarCanada2015.gerardm.com
2 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Product & I.T.
I.T.
Embedded
Telecom
My Background
Gerard Meszaros
StarCanada2015@gerardm.com
• Software developer
• Development manager
• Project Manager
• Software architect
• OOA/OOD Mentor
• Requirements (Use Case) Mentor
• XP/TDD Mentor
• Agile PM Mentor
• Test Automation Consultant & Trainer
• Lean/Agile Coach/Consultant
4. 2
3 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Product & I.T.
I.T.
Embedded
Telecom
My Background
• Software developer
• Development manager
• Project Manager
• Software architect
• OOA/OOD Mentor
• Requirements (Use Case) Mentor
• XP/TDD Mentor
• Agile PM Mentor
• Test Automation Consultant & Trainer
• Lean/Agile Coach/Consultant
Gerard Meszaros
StarCanada2015@gerardm.com
4 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Agile
Dev
I’m From Development and I’m Here to Help
6. 4
7 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Dev
Test & Fix “Battleship”
Development
Quality
Assessment
Bug Reports
Software
Requirements
B6! Missed!
Requirements
Test
8 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
The Agile Test Problem
Requirements
Development
Testing
7. 5
9 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
The Agile Test Problem
Testing
Development
Requirements
Testing
Development
Requirements
10 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
The Agile Test Problem
Testing
Development
Requirements
Testing
Development
Requirements
Testing
Development
Requirements
Testing
Development
Requirements
9. 7
13 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
empowering
http://www.slideshare.net/b2bSEO/robots-replacing-humans-automation
14 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Value of Automated Tests
Tests as Documentation
Faster regression testing
Faster feedback on impact of changes
Better coverage of data combinations
Test with data without seeing that confidential data
Provides more time for exploratory testing
Can be done off hours; reduces delay/resources
Writing tests helps us understand code better
Know when problem was introduced
Fast sanity checking
Performance or load testing
Setting up complex scenarios for manual/exploratory testing
Unit/module tests improve modularity design and API’s
Help Business understand what we/they are asking for
Courtesy of participants of Tuesday’s tutorial
10. 8
15 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Automated Tests are Just Code
That Tests Other Code
Who Tests This Code?
Who Should Write This Code?
16 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Audience Survey
https://lmsa.site-ym.com/news/221726/Sex-and-Gender-Medical-Education-National-Student-Survey.htm
12. 10
19 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Insanity:
• Doing the same thing over and over again and
expecting different results
20 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Project Retrospectives
13. 11
21 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
The Prime Directive
Regardless of what we discover, we
understand and truly believe that
everyone did the best job they could,
given what they knew at the time, their
skills and abilities, the resources
available, and the situation at hand
22 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Agile Retrospectives / Sprint Reviews
14. 12
23 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Ineffective Retrospectives
Stop
Start
More
Actions
1. Do something
2. Do another thing
3. Do yet another
thing
4. Do more stuff
5. Do yet more stuff
6.
24 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Ineffective Retrospectives
Stop
Start
More
Actions
1. Do something
2. Do another thing
3. Do yet another
thing
4. Do more stuff
5. Do yet more stuff
6.
How Do We Improve Retrospectives?
15. 13
25 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
One Experiment per Iteration
Stop
Start
More 1. Hypothesis
2. Experiment
3. Analyse
4. Communicate
26 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
The Toyota Way
16. 14
27 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
5 Why’s
www.123rf.com
28 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
5 Why’s of Test Automation Being Hard
Tests need to
interact via
the UI
Test
Automation
is Hard!
Product isn’t
designed for
testability
Why? Why?
Why?
Tests are
very complex
17. 15
29 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
5 Why’s of Test Automation Being Hard
Dev doesn’t
know how
(or care)
Tests need to
interact via
the UI
Test
Automation
is Hard!
It’s QA’s
problem
Tests are
automated after
Dev Complete
QA isn’t
involved in
product
definition
Product isn’t
designed for
testability
Why? Why?
Why?
Why?
Why?
Why?
Tests are
very complex
Why?
Why?
30 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
5 Why’s of Test Automation Being Hard
Dev doesn’t
know how
(or care)
Tests need to
interact via
the UI
Test
Automation
is Hard!
It’s QA’s
problem
Tests are
automated after
Dev Complete
QA isn’t
involved in
product
definition
QA is too
busy testing
last release
Product isn’t
designed for
testability
Why? Why?
Why?
Why?
Why?
Why?
Why?
Why?
Tests are
very complex
Why?
Why?
QA is supposed
to be
“independent”
Why?
18. 16
31 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Systems Thinking
A B
+
C
-
Notation:
+ Increasing
- Reducing
32 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Systems Thinking
A B
+
C
-
+ +
Notation:
+ Increasing
- Reducing
Reinforcing
Cycle
Balancing
Cycle
19. 17
33 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Systems Thinking
A B
+
C
-
+ +
Notation:
+ Increasing
- Reducing
Vicious or
Virtuous
Cycle
34 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
5 Why’s of Test Automation Being Hard
Dev doesn’t
know how
(or care)
Tests need to
interact via
the UI
Test
Automation
is Hard!
It’s QA’s
problem
Tests are
automated after
Dev Complete
QA isn’t
involved in
product
definition
QA is too
busy testing
last release
Product isn’t
designed for
testability
Why? Why?
Why?
Why?
Why?
Why?
Why?
Why?
Tests are
very complex
Why?
Why?
QA is supposed
to be
“independent”
Why?
20. 18
35 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Test Automation – Systems Thinking Diagram
Dev doesn’t
know how
(or care)
Tests need to
interact via
the UI
Test
Automation
is Hard!
It’s QA’s
problem
Tests are
automated after
Dev Complete
QA isn’t
involved in
product
definition
QA is too
busy testing
last release
Product isn’t
designed for
testability
+ +
+
+
+
+
+
+
Tests are
very complex
+
+
QA is supposed
to be
“independent”
+
A Vicious Cycle
36 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Conway’s Law
The Architecture of System will resemble the
Organization that Built it.
Development
Team
Test
Team
Business
Team
21. 19
37 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Resulting Architecture
Specifi-
cations
Product
Code
Test
Code
Bus Test
Dev
38 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Example-Driven Development
Development flow
Potentially
Executable
Specifications
Example
Interpreter
Code Product
Code
Dev
Test
Dev
DevTestBus Test
22. 20
39 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Example-Driven Development
Runtime View:
Product
Code
Example
Interpreter
Code
Report
Card
Potentially
Executable
Specifications
Dev
Test
Dev
DevTestBus Test
40 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Example-Driven Development
Feedback Loops:
Potentially
Executable
Specifications Product
Code
Example
Interpreter
Code
Report
Card
What they say
How they say it
23. 21
41 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Example-Driven Development
Feedback Loops:
Potentially
Executable
Specifications Product
Code
Example
Interpreter
Code
Report
Card
What they say
How they say it
Isn’t This “Just”
Test Automation
By Another Name?
42 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Tests vs. Checks vs. Examples?ref: http://www.satisfice.com/blog/archives/856
24. 22
43 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Preparing Good Examples
http://thepracticalleader.com/
44 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Example: Notifying of Bank Transactions
Configure
Notification
Rules
Suspend
Notification
Resume
Notification
Account
Holder
Process
Transaction
Transaction
Settlement
NotifybasedonchargeType
NotifybasedonchargeContinent
NotifybasedonchargeCountry
NotifybasedonchargeCity&State
SuspendNotification
25. 23
45 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Checking Notifications
• Open MegaBank app
• Log in as “BobMa” with password ******
• Click on “Manage Notifications” tab
• Click on “Add New Rule” button
• Select account “10035692877”
• Type “Default Rule” into field “rule name”
• Type “1000” into field “threshold amount”
• Click on “all transaction types” radio button
• Click on “all locations” radio button
• Click on “save changes” button
• …
• …
46 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Checking Notifications – 1/2
Given:
User and Accounts
Another
attempt:
When:
Notification
Rule is Configured
Then:
Notification Rule
Configured and
Active
Then:
Notification Rule
is Active
26. 24
47 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Checking Notifications – 2/2
Then: Expected
Notifications
When: The
Transactions to
be processed
Another
attempt:
48 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Test Automation Pyramid
Pyramid originally proposed by Mike Cohn
Exploratory Tests
Unit Tests
Component
Tests (API)
System
Tests (GUI)
27. 25
49 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Behavior Specification at Right Level
Unit Tests
Component
Tests (API)
System
Tests (GUI)
Broad Narrow
Detail
HighLow
Scope
50 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Behavior Specification at Right Level
Broad Narrow
Detail
HighLow
Scope
Component
Tests (API)
System
Tests (GUI)
28. 26
51 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Behavior Specification at Right Level
Component
Tests (API)
System
Tests (GUI)
Rules &
Algorithms
Multi-
Use Case
Workflows
Incomplete
Spec
Too
much detail
Unmaintainable
Detail
HighLow
Broad Narrow
Scope
Transactions
(Use Cases)
52 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Too
much detail
Unmaintainable
Changing Level of Abstraction/Detail
Rules &
Algorithms
Multi-
Use Case
Workflows
Transactions
(Use Cases)
Reduce
Scope a Lot!
ReduceDetailaLot
Reduce
Both a bit
Incomplete
Spec
Broad Narrow
Detail
HighLow
Scope
29. 27
53 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Refactoring Workflow Example
Given:
User and Accounts
When:
Notification
Rule is Configured
Then:
Notification Rule
Configured and
Active
Then:
Notification Rule
is Active
54 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Refactoring Workflow Example
“If it isn’t essential to conveying the
essence of the behavior, it is essential to
not include it.”
30. 28
55 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Then: Expected
Notifications
When: The
Transactions to
be processed
Refactoring Workflow Example
56 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Refactoring Workflow Example
31. 29
57 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Refactoring Workflow Example
58 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Refactoring Workflow ExampleGiven:
User &
Thresholds
When:
Transactions
Are Processed
Then:
We Expect
Notifications
32. 30
59 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Given:
User &
Thresholds
When:
Transactions
Are Processed
Then:
We Expect
Notifications
credit
credit
9991113333
Refactoring Workflow Example
60 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
9991113333
Refactoring Workflow Example
Broad Scope (Multi-Actor);
Minimum Detail (per Actor/Transaction);
Given:
User &
Thresholds
When:
Transactions
Are Processed
Then:
We Expect
Notifications
credit
credit
33. 31
61 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Filling in the Details
Rules &
Algorithms
Multi-
Use Case
Workflows
Transactions
(Use Cases)
Incomplete
Spec
ReduceDetailaLot
Reduce
Both a bit
Too
much detail
Unmaintainable
Reduce
Scope a Lot!
Broad Narrow
Detail
HighLow
Scope
62 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Business Rule Example
Process Transaction
Threshold per Charge Type
Configuration
34. 32
63 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Process Transaction
Threshold per Charge Type
Narrow Scope (Single Rule)
High Detail (Everything that matters)
Example:
Configuration Given these
rules
Then: The
answer should be
Business Rule Example
When we ask
NotificationRequired?
with this transaction:
64 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Life Cycle of an Example
User
Goal
Feature
Story
Title
Story
Narrative
Story
Scenarios
Story
Examples
Executable
Examples
Satisfied
Examples
Formalize
Automate
Develop
Product
Make Concrete
Add Data
Define
Acceptance
Criteria
Work
Breakdown
Product
Design &
Validation
Elaborate
35. 33
65 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Who Does Activities on an Example
User
Goal
Feature
Story
Title
Story
Narrative
Story
Scenarios
Story
Examples
Executable
Examples
Satisfied
Examples
Formalize
Automate
Develop
Product
Make Concrete
Add Data
Define
Acceptance
Criteria
Work
Breakdown
Product
Design &
Validation
Elaborate
DevTest
Bus
DevTest Bus
Dev
Test
Bus
66 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Test-After Architecture
System Under Test
Should we
Notify?Process
Transaction
Configure
Notification
Threshold
Notification
Rules
Transaction
Interface
Configuration
User
Interface
Notification
Log
Workflow
Test
Do
Notification.
Bus
Test Dev
36. 34
67 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Example-Driven Architecture
System Under Test
Should we
Notify?
Do
Notification.
Process
Transaction
Configure
Notification
Threshold
Notification
Rules
Notification
Log
Transaction
Interface
Configuration
User
Interface
Workflow
Example
Workflow
Keyword
Interpreter
Dev Dev
Bus
Test
68 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Transaction
Interface
Configuration
User
Interface
Configure
Notification
Threshold System Under Test
EDA – Business Rules
Do
Notification.
Process
Transaction
Notification
Rules
Notification
Log
Notification
Method Example
Notification
Rules Fake
Notification
Rule Example
Should we
Notify?
Example
Interpreter
Example
Interpreter
Dev
Bus
Test Dev
37. 35
69 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
EDA – Business Rules
Should we
Notify?
Notification
Rules Fake
Notification
Rule Example
Example
Interpreter
Dev
Bus
Test Dev
70 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
After State – Back to Our Systems Diagram
Dev doesn’t
know how
(or care)
Tests need to
interact via
the UI
Test
Automation
is Hard!
It’s QA’s
problem
Tests are
automated after
Dev Complete
QA isn’t
involved in
product
definition
QA is too
busy testing
last release
Product isn’t
designed for
testability
+ +
+
+
+
+
+
+
Tests are
very complex
+
+
QA is supposed
to be
“independent”
+
X
X
X
X X
XXX
38. 36
71 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
After State – Back to Our Systems Diagram
Dev knows
how (and
cares)
Examples
don’t need to
interact via
the UI
Automated
checking is
Easy!
Automation
is Dev’s
problem
Examples are
automated
before Dev
starts
QA is
involved in
product
definition
QA has time for
Examples and
Exploratory
testing
Product is
designed for
testability
+ +
+
+
+
+
+
+
Examples are
simple
+
+
A Virtuous Cycle
72 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
My Challenge to You
Stop
Start
More 1. Hypothesis
2. Experiment
3. Analyse
4. Communicate
39. 37
73 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
74 Copyright 2015 Gerard Meszaroshttp://StarCanada2015.gerardm.com
Thank You!
Gerard Meszaros
StarCanada2015@gerardm.com
http://www.xunitpatterns.com
Slides: http://StarCanada2015.gerardm.com
Call me when you:
• Want to transition to Agile or Lean
• Want to do Agile or Lean better
• Want to teach developers how to test
• Need help with test automation strategy
• Want to improve your test automation
Jolt Productivity Award
winner - Technical Books
Available on MSDN: