www.techtalk.at
Setting up Complex Scenarios for Automated Tests
Paul Rohorzka
Software Gardener
February 22nd, 2017
Seeding a Tree in a Gherkin
@paulroho
pro@techtalk.at
2
What's Your Occupation?
?
3
What is
right?
Make it
right
Is it
right?
Requirements Engineer
Product Owner
Developer
Tester
QA
PM
Testautomation Engineer
Architect
4
Arrange
Act
Assert
Setup
Execute
Verify
What is right? Make it right Is it right?
Given
When
Then
By original uploader: Roke - Own work, CC BY-SA 3.0,
https://commons.wikimedia.org/w/index.php?curid=31996181
5
Setup
Execute
Verify
Given
When
Then
Arrange
Act
Assert
Three Parts of an
Automated Test What is the
scenario?
What should trigger
the behaviour?
Important question:
How are they
related?
Can I actually observe
what I expected?
6
Example: Unit Level
GetFormattedValue
value
format
(return)
7
Same With Acceptance/End-to-End?
IN
OUT
8
Setup
Check
This talk
... and a little bit ...
It's Often Like This
9
So Much Information!
10
What Are My Options?
11
 Can feel clean (???)
 Hidden Setup
 Incomplete Scenario
 Obscuring important parts
 Dependencies
 State?!
 What if scaling out?
Classical Option 1: Common Test Data Set
Data B
Data C
Data A
Data Y
Data X
Data Z
Test 2
Test 3
Test 1
Test 98
Test 97
Test 99
Code, Database, File, ...
12
 Easy to get via refactoring
 Gets quickly out of hand (overloads, optional parameters, ...)
Classical Option 2: Setup Method
13
 Can be easily extended (as domain grows)
 IDE can help (Intellisense)
 Initial effort
 Needing multiple parts of complex structure
Classical Option 3: Builders
14
Taking Builders Further
15
No Matter What – Think of the Reader!
What would we
like to read?
Write it down!
Do we like it?
Fix the syntax!
Do we still like it?
Make it work!
Imagine Engage Accomplish
16
Use whatever works best
for the people involved
https://flic.kr/p/47xDKh
It's Showtime!
https://flic.kr/p/aN2zDe
Act 1:
Specifying a C# API
Structure of an Organization
"Org Units"
20
Specifying the InfoManager API
InfoManager
Client
C#
API
Specs
21
The Obvious Approach:
Unit Tests
22
The Obvious Approach:
Unit Tests
23
• Where is the code under test?
• How let the spec stand out from other low-level unit tests?
• The client app's developer is the user of your API
• The interface might be subject of a conversation
• It defines the behaviour (i.e. more than the static contract)
 Give Gherkin a try!
Considerations
24
Interlude: The Gherkin Language
Given
When
Then
25
Connecting Gherkin With Code
"Step Bindings"
27
Our Take – The Specs
28
Our Take – One More
29
• Bindings might get increasingly messy
• Refactoring can make the specs wrong
Some Downsides
30
Act 2:
Building a Permission
Chain
https://flic.kr/p/4SxU1r
Introducing PERSY
(PERmission SYstem)
• 6 chained objects
• Each active/inactive
• Ignore chain if one object is inactive
User Position
AD-Group
Groupm:n m:n
33
Setup in 6 one-liners?
34
Super-Entity
to the rescue!
https://flic.kr/p/eXQbXV
35
Super entity PermissionChain
User Position
AD-Group
Groupm:n m:n
PermissionChain
36
PermissionChainBuilder in Action
37
Stress your imagination!
38
String Representation in Unit Testing Style
39
Utilizing Gherkin Style
Syntax
highlighting
Variations:
40
The Catch
Fragile!
 Meta tests
Is it worth it?
Yes, if this is part of
the core domain
1 out of 50+!
41
A Meta Test
42
Act 3:
Seeding A Tree
https://flic.kr/p/ooBmLt
44
Testing a Feature Based on a Tree Structure
"Org Units"
45
In the Database
46
Obvious Approach: Domain Model API
47
Next Attempt: Builders
48
Going Meta: Meta-Builder
49
Switching to Gherkin
50
Away With the Parent References
51
Away With That Many Columns
52
Away With the Table
53
Away With the Dots
54
Some ASCII Art
55

56
Is It Worth The Trouble?
ReadabilityEase of Usage
Effort of
Implementation
Living
Documentation
maintain
extend
discover
edit
57
Build
ReflectDecide
Hint: Iterate!
Don't try to build
too much magic
up front!
58
Put First
What You Would Love to See
Not What You Have.
By Mstyslav Chernov - Self-photographed, http://mstyslav-chernov.com/, CC
BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=28541140
59
Thank You!
Your Thoughts?
60

More Related Content

PDF
Peer Code Review: In a Nutshell
PPTX
ATAGTR2017 Expanding test horizons with Robot Framework
ODP
Automating good coding practices
PDF
Static Analysis For Security and DevOps Happiness w/ Justin Collins
PPTX
Expanding Your .NET Testing Toolbox - GLUG NET
PPTX
SpecFlow for Agile Teams
PPTX
Automated tests to a REST API
PPT
Code Review
Peer Code Review: In a Nutshell
ATAGTR2017 Expanding test horizons with Robot Framework
Automating good coding practices
Static Analysis For Security and DevOps Happiness w/ Justin Collins
Expanding Your .NET Testing Toolbox - GLUG NET
SpecFlow for Agile Teams
Automated tests to a REST API
Code Review

What's hot (18)

PPT
Points.com fisheye crucible code reviews 2011
PPTX
How do you tame a big ball of mud? One test at a time.
DOCX
Dependency injection& comparative study
PPTX
Spec flow – functional testing made easy
PDF
End-to-end performance testing, profiling, and analysis at Redis
PDF
Code Review: How and When
PDF
Android Test Driven Development & Android Unit Testing
PDF
In graph we trust: Microservices, GraphQL and security challenges
PPTX
How to improve code quality for iOS apps?
PPTX
Improving Code Quality Through Effective Review Process
PDF
Effective code reviews
PPTX
Choosing an IoC container
PPTX
Git branching policy and review comment's prefix
PDF
Code Review: How and When
PDF
Automated testing in javascript
ODP
Java code coverage with JCov. Implementation details and use cases.
Points.com fisheye crucible code reviews 2011
How do you tame a big ball of mud? One test at a time.
Dependency injection& comparative study
Spec flow – functional testing made easy
End-to-end performance testing, profiling, and analysis at Redis
Code Review: How and When
Android Test Driven Development & Android Unit Testing
In graph we trust: Microservices, GraphQL and security challenges
How to improve code quality for iOS apps?
Improving Code Quality Through Effective Review Process
Effective code reviews
Choosing an IoC container
Git branching policy and review comment's prefix
Code Review: How and When
Automated testing in javascript
Java code coverage with JCov. Implementation details and use cases.
Ad

Similar to Seeding a Tree in a Gherkin (20)

PDF
From silex to symfony and viceversa
PPTX
DockerCon SF 2019 - Observability Workshop
PDF
Unlocking the Power of ChatGPT and AI in Testing - NextSteps, presented by Ap...
PPTX
From Duke of DevOps to Queen of Chaos - Api days 2018
PPTX
DevOps - Boldly Go for Distro
PDF
JS Fest 2018. Никита Галкин. Микросервисная архитектура с переиспользуемыми к...
PDF
Building Efficient Software with Property Based Testing
PDF
Behaviour Driven Development: Oltre i limiti del possibile
PPTX
Getting Started with Test-Driven Development at Longhorn PHP 2023
PDF
So You Just Inherited a $Legacy Application… NomadPHP July 2016
PDF
DIY Transparent Release Management_2024_07.pdf
PPTX
DockerCon SF 2019 - TDD is Dead
PDF
Improve existing code with confidence, supported by unit tests
PDF
Testing in a glance
PDF
So You Just Inherited a $Legacy Application...
PPTX
Getting Started with Test-Driven Development at PHPtek 2023
PDF
OSS Japan - Application Monitoring And Tracing In Kubernetes
PPTX
Testing for Logic App Solutions | Integration Monday
PDF
Denver Salesforce DUG DF 2018 roundup
PPT
Lessons Learned in a Continuously Developing Service-Oriented Architecture
From silex to symfony and viceversa
DockerCon SF 2019 - Observability Workshop
Unlocking the Power of ChatGPT and AI in Testing - NextSteps, presented by Ap...
From Duke of DevOps to Queen of Chaos - Api days 2018
DevOps - Boldly Go for Distro
JS Fest 2018. Никита Галкин. Микросервисная архитектура с переиспользуемыми к...
Building Efficient Software with Property Based Testing
Behaviour Driven Development: Oltre i limiti del possibile
Getting Started with Test-Driven Development at Longhorn PHP 2023
So You Just Inherited a $Legacy Application… NomadPHP July 2016
DIY Transparent Release Management_2024_07.pdf
DockerCon SF 2019 - TDD is Dead
Improve existing code with confidence, supported by unit tests
Testing in a glance
So You Just Inherited a $Legacy Application...
Getting Started with Test-Driven Development at PHPtek 2023
OSS Japan - Application Monitoring And Tracing In Kubernetes
Testing for Logic App Solutions | Integration Monday
Denver Salesforce DUG DF 2018 roundup
Lessons Learned in a Continuously Developing Service-Oriented Architecture
Ad

Recently uploaded (20)

PDF
AI Guide for Business Growth - Arna Softech
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
PDF
Types of Token_ From Utility to Security.pdf
PDF
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
PPTX
Patient Appointment Booking in Odoo with online payment
PDF
iTop VPN Crack Latest Version Full Key 2025
PPTX
Weekly report ppt - harsh dattuprasad patel.pptx
PDF
Cost to Outsource Software Development in 2025
PDF
Salesforce Agentforce AI Implementation.pdf
PPTX
Computer Software - Technology and Livelihood Education
PDF
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
PDF
Microsoft Office 365 Crack Download Free
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PPTX
Tech Workshop Escape Room Tech Workshop
PDF
How Tridens DevSecOps Ensures Compliance, Security, and Agility
PDF
Wondershare Recoverit Full Crack New Version (Latest 2025)
PDF
Visual explanation of Dijkstra's Algorithm using Python
PDF
DNT Brochure 2025 – ISV Solutions @ D365
PDF
Multiverse AI Review 2025: Access All TOP AI Model-Versions!
AI Guide for Business Growth - Arna Softech
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
Types of Token_ From Utility to Security.pdf
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
Patient Appointment Booking in Odoo with online payment
iTop VPN Crack Latest Version Full Key 2025
Weekly report ppt - harsh dattuprasad patel.pptx
Cost to Outsource Software Development in 2025
Salesforce Agentforce AI Implementation.pdf
Computer Software - Technology and Livelihood Education
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
Microsoft Office 365 Crack Download Free
Advanced SystemCare Ultimate Crack + Portable (2025)
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Tech Workshop Escape Room Tech Workshop
How Tridens DevSecOps Ensures Compliance, Security, and Agility
Wondershare Recoverit Full Crack New Version (Latest 2025)
Visual explanation of Dijkstra's Algorithm using Python
DNT Brochure 2025 – ISV Solutions @ D365
Multiverse AI Review 2025: Access All TOP AI Model-Versions!

Seeding a Tree in a Gherkin