SlideShare a Scribd company logo
Making property-based testing
easier to read for humans
Laura M. Castro
February 18th, 2016
Stakeholder involvement & software testing
The challenge of communication
Active stakeholder participation is an agile best practice1
Early testing is also an agile best practice1
1
Agile practices are considered mainstream, with adoption rates ≈50%2 of 30
Stakeholder involvement & software testing
The challenge of communication
Active stakeholder participation is an agile best practice1
stakeholder involvement requires inclusive modeling
(UML activity diagrams, user stories)
Early testing is also an agile best practice1
best represented by Test-Driven Development (TDD)
1
Agile practices are considered mainstream, with adoption rates ≈50%2 of 30
Stakeholder involvement & software testing
The challenge of communication
Active stakeholder participation is an agile best practice1
stakeholder involvement requires inclusive modeling
(UML activity diagrams, user stories)
Early testing is also an agile best practice1
best represented by Test-Driven Development (TDD)
stakeholder involvement + early testing =
Behaviour-Driven Development (BDD)
1
Agile practices are considered mainstream, with adoption rates ≈50%2 of 30
Behaviour-Driven Development
Feature: Deletion of element from list
In order to operate lists
As a user of the lists module
I want to delete an element from a list
Scenario: Delete integer from list of integers
Given I have the integer 3
And I have the list of integers [0,8,6]
When I use the function lists:delete/2
Then the resulting list should not contain 3
3 of 30
Behaviour-Driven Development
The behaviour becomes test case
given("I have the integer (d+)", S, [Num]) ->
{ok, S ++ [list_to_integer(Num)]};
...
when("I use the function (w+) from the module (w+)", S, [F, M]) ->
{ok, apply(list_to_atom(M), list_to_atom(F), S)}.
then("the resulting list should not contain (d+)", S, [Num]) ->
case not lists:member(list_to_integer(Num), S) of
true -> {ok, S};
false -> {failed, S}
end.
4 of 30
Behaviour-Driven Development
Is this catching on?
5 of 30
Behaviour-Driven Development
Is this catching on?
6 of 30
Behaviour-Driven Development
Pros and cons
Good as communication tool
a number of implementations in many languages:
C++, Clojure, Erlang, Java, JavaScript, Lua, .NET, PHP,…
Not as good as testing tool
run as many test cases as you can write
well-known problems of “traditional” testing:
specification, implementation, maintainability, effectiveness
7 of 30
Property-Based Testing (PBT)
Strategy for improved testing: abstraction + automation
write properties instead of test cases
properties are used to automatically
generate, run, and diagnose many, many test cases
8 of 30
Property-Based Testing
A very simple example
How do you write properties? Let’s start simple:
Example: delete an element from a list
9 of 30
Property-Based Testing
A very simple example
How do you write properties? Let’s start simple:
Example: delete an element from a list
Desired functionality?
If I delete an element from a list,
it shouldn't be there anymore.
9 of 30
Property-Based Testing
A very simple example
How do you write properties? Let’s start simple:
Example: delete an element from a list
Desired functionality?
If I delete an element from a list,
it shouldn't be there anymore.
Which item? Which list? Any.
9 of 30
Property-Based Testing
A very simple example
prop_simple() ->
?FORALL(I, item(),
?FORALL(L, list(item()),
not lists:member(I, lists:delete(I, L)))).
10 of 30
Property-Based Testing
A very simple example
prop_simple() ->
?FORALL(I, item(),
?FORALL(L, list(item()),
not lists:member(I, lists:delete(I, L)))).
11 of 30
Property-Based Testing
A very simple example
prop_simple() ->
?FORALL(I, item(),
?FORALL(L, list(item()),
not lists:member(I, lists:delete(I, L)))).
12 of 30
Property-Based Testing
A very simple example
prop_simple() ->
?FORALL(I, item(),
?FORALL(L, list(item()),
[] == [ X || X <- lists:delete(I, L), X == I])).
13 of 30
Property-Based Testing
A very simple example
prop_simple() ->
?FORALL(I, item(),
?FORALL(L, list(item()),
not lists:member(I, lists:delete(I, L)))).
14 of 30
Property-Based Testing
A very simple example
> eqc:quickcheck(simple_eqc:prop_simple()).
................................................
................................................
....
OK, passed 100 tests
15 of 30
Property-Based Testing
A very simple example
> eqc:quickcheck(simple_eqc:prop_simple()).
................................................
.................... Failed! After 69 tests.
15
[-13,-15,-2,-17,-20,15,15]
Shrinking xxxxxxxx.xx.xxxxxxxx (2 times)
15
[15,15]
16 of 30
Property-Based Testing
A more complex example
How complex can it get? Models for stateful components.
Example: EVM registry
register(Name, Pid) -> ok
unregister(Name) -> ok
whereis(Name) -> Pid | undefined
17 of 30
Property-Based Testing
A more complex example
How complex can it get? Models for stateful components.
Example: EVM registry
register(Name, Pid) -> ok
unregister(Name) -> ok
whereis(Name) -> Pid | undefined
Desired functionality?
If I perform a sequence of registry actions,
I expect compliance with model at all times.
17 of 30
Property-Based Testing
A more complex example
How complex can it get? Models for stateful components.
Example: EVM registry
register(Name, Pid) -> ok
unregister(Name) -> ok
whereis(Name) -> Pid | undefined
Desired functionality?
If I perform a sequence of registry actions,
I expect compliance with model at all times.
Which sequences of actions? Any.
17 of 30
Property-Based Testing
A more complex example
prop_registry() ->
?FORALL(Cmds, commands(registry_model),
begin
... % setup code
{H, S, TResult} = run_commands(registry_model,Cmds),
... % cleanup code
TResult == ok
end).
18 of 30
Property-Based Testing
A more complex example
prop_registry() ->
?FORALL(Cmds, commands(registry_model),
begin
... % setup code
{H, S, TResult} = run_commands(registry_model,Cmds),
... % cleanup code
TResult == ok
end).
19 of 30
Property-Based Testing
A more complex example
register_pre(S) ->
S#state.pids /= [].
...
unregister_next(S,_,[Name]) ->
S#state{regs = lists:keydelete(Name,1,S#state.regs)}.
...
whereis_post(S, [Name], Result) ->
case lists:keyfind(Name, 1, S#state.regs) of
{Name,Value} -> Res =:= Value;
false -> Res =:= undefined
end.
20 of 30
Property-Based Testing
Pros and cons
Good as testing tool
run as many test cases as you have time to execute
run different test cases every time
get reduced counterexamples, for focused debugging
get a functional specification of the software
a number of implementations in many languages:
Clojure, Lisp, Erlang, ML, Prolog, Scala, Scheme, Smalltalk,…
Not as good as communication tool
21 of 30
readSpec
making PBT easier to read for humans
Get (semi)natural language descriptions
for sample test cases that test properties produce
1. Write PBT artifacts (properties, models)
2. Get readSpec to translate them into cucumber-like features
implemented in Erlang
uses Quviq QuickCheck’s coverage-based suite generation
Available at:
https://github.com/prowessproject/readspec
22 of 30
readSpec
A very simple example: what do you get?
File: simple.feature
FEATURE: simple
Simple QuickCheck properties
...
SCENARIO: Deleting an integer from a list should
result in a list that does not contain that integer.
GIVEN I have the integer 6
AND I have the list [-1, 2, 13, 0, 5]
THEN IS FALSE THAT the integer 6 is in
the result of calling lists:delete/2
with 6 and [-1, 2, 13, 0, 5].
...
23 of 30
readSpec
A very simple example: what do you get?
File: prop_simple.counterexample.feature
GIVEN I have the integer 15
AND I have the list [15, 15]
THEN the integer 15 is in
the result of calling lists:delete/2 with 15 and [15, 15].
24 of 30
readSpec
A very simple example: what do you get?
**********************************************************
CALL: register/2
**********************************************************
POSSIBILITIES ...
================================
*** REQUIREMENTS ***
[*] The field called "pids" must be equal to the empty list
*** RESULT ***
the literal 'false'
================================
OTHERWISE ...
================================
*** RESULT ***
the literal 'true'
25 of 30
VoDKATV: industrial pilot study
26 of 30
VoDKATV: industrial pilot study
Research questions
RQ 1) Can readSpec produce efficient text representations of
test properties?
RQ 2) Are readSpec text representations an effective way to
communicate among stakeholders?
27 of 30
VoDKATV: industrial pilot study
Measurements
RQ 1) Amount of time to generate the textual representation
RQ 1) LOC of textual representations w.r.t.
LOC of corresponding test properties/models
RQ 2) Stakeholders average rating of usefulness
(would use them instead of current way of communic.?)
RQ 2) Stakeholders average rating of usability
(appropriate? easy to understand/follow?)
28 of 30
VoDKATV: industrial pilot study
Results
Amount of time needed in the order of milliseconds
Nature of output (verbosity, number of lines) appropriate
Simple cases: high degree of influence of personal skills and
background on deeming text more helpful than property code
Complex cases: some people still cannot make sense of
either; the rest consistently agree the text is more helpful
enough to provide the insights needed to suggest more tests!
29 of 30
readSpec: making PBT easier to read for humans
Final quotes
“readSpec looks human-friendly”
“simple cases are too verbose for tech people (code is shorter)”
“helps in understanding tests better, especially when they’re complex”
“it’s interesting when cases reach certain complexity”
“presents requirements in an explicit way, that can slip your mind o/w”
“this is very helpful for people who are not familiar with the code”
“only with a good level of maturity and experience one could be more
comfortable with QC properties and models”
30 of 30

More Related Content

What's hot

A Natural Language Programming Approach for Requirements-based Security Testing
A Natural Language Programming Approach for Requirements-based Security TestingA Natural Language Programming Approach for Requirements-based Security Testing
A Natural Language Programming Approach for Requirements-based Security Testing
Lionel Briand
 
10 software testing_technique
10 software testing_technique10 software testing_technique
10 software testing_technique
University of Computer Science and Technology
 
Automated and Scalable Solutions for Software Testing: The Essential Role of ...
Automated and Scalable Solutions for Software Testing: The Essential Role of ...Automated and Scalable Solutions for Software Testing: The Essential Role of ...
Automated and Scalable Solutions for Software Testing: The Essential Role of ...
Lionel Briand
 
findbugs Bernhard Merkle
findbugs Bernhard Merklefindbugs Bernhard Merkle
findbugs Bernhard Merkle
bmerkle
 
Sta unit 3(abimanyu)
Sta unit 3(abimanyu)Sta unit 3(abimanyu)
Sta unit 3(abimanyu)
Abhimanyu Mishra
 
SAIConference_PAPER
SAIConference_PAPERSAIConference_PAPER
SAIConference_PAPER
Zainab Nayyar
 
An Approach to Software Testing of Machine Learning Applications
An Approach to Software Testing of Machine Learning ApplicationsAn Approach to Software Testing of Machine Learning Applications
An Approach to Software Testing of Machine Learning Applications
butest
 
SBST 2019 Keynote
SBST 2019 Keynote SBST 2019 Keynote
SBST 2019 Keynote
Shiva Nejati
 
Transferring Software Testing Tools to Practice (AST 2017 Keynote)
Transferring Software Testing Tools to Practice (AST 2017 Keynote)Transferring Software Testing Tools to Practice (AST 2017 Keynote)
Transferring Software Testing Tools to Practice (AST 2017 Keynote)
Tao Xie
 
Mutation Analysis and Testing for Cyber-Physical Systems: Scalable Solutions...
Mutation Analysis and Testing for Cyber-Physical Systems: Scalable Solutions...Mutation Analysis and Testing for Cyber-Physical Systems: Scalable Solutions...
Mutation Analysis and Testing for Cyber-Physical Systems: Scalable Solutions...
fabriziopastore
 
Code coverage based test case selection and prioritization
Code coverage based test case selection and prioritizationCode coverage based test case selection and prioritization
Code coverage based test case selection and prioritization
ijseajournal
 
Black Box Testing
Black Box TestingBlack Box Testing
Black Box Testing
Mustafa Sherazi
 
Sta unit 2(abimanyu)
Sta unit 2(abimanyu)Sta unit 2(abimanyu)
Sta unit 2(abimanyu)
Abhimanyu Mishra
 
Finding bugs that matter with Findbugs
Finding bugs that matter with FindbugsFinding bugs that matter with Findbugs
Finding bugs that matter with Findbugs
Carol McDonald
 
Diversity Maximization Speedup for Fault Localization
Diversity Maximization Speedup for Fault LocalizationDiversity Maximization Speedup for Fault Localization
Diversity Maximization Speedup for Fault Localization
Liang Gong
 
Rv11
Rv11Rv11
Istqb ctfl-series - Black Box Testing
Istqb ctfl-series - Black Box TestingIstqb ctfl-series - Black Box Testing
Istqb ctfl-series - Black Box Testing
Disha Srivastava
 
Amin Milani Fard: Directed Model Inference for Testing and Analysis of Web Ap...
Amin Milani Fard: Directed Model Inference for Testing and Analysis of Web Ap...Amin Milani Fard: Directed Model Inference for Testing and Analysis of Web Ap...
Amin Milani Fard: Directed Model Inference for Testing and Analysis of Web Ap...
knowdiff
 
Software Testing Techniques
Software Testing TechniquesSoftware Testing Techniques
Software Testing Techniques
Kiran Kumar
 
Advances in Unit Testing: Theory and Practice
Advances in Unit Testing: Theory and PracticeAdvances in Unit Testing: Theory and Practice
Advances in Unit Testing: Theory and Practice
Tao Xie
 

What's hot (20)

A Natural Language Programming Approach for Requirements-based Security Testing
A Natural Language Programming Approach for Requirements-based Security TestingA Natural Language Programming Approach for Requirements-based Security Testing
A Natural Language Programming Approach for Requirements-based Security Testing
 
10 software testing_technique
10 software testing_technique10 software testing_technique
10 software testing_technique
 
Automated and Scalable Solutions for Software Testing: The Essential Role of ...
Automated and Scalable Solutions for Software Testing: The Essential Role of ...Automated and Scalable Solutions for Software Testing: The Essential Role of ...
Automated and Scalable Solutions for Software Testing: The Essential Role of ...
 
findbugs Bernhard Merkle
findbugs Bernhard Merklefindbugs Bernhard Merkle
findbugs Bernhard Merkle
 
Sta unit 3(abimanyu)
Sta unit 3(abimanyu)Sta unit 3(abimanyu)
Sta unit 3(abimanyu)
 
SAIConference_PAPER
SAIConference_PAPERSAIConference_PAPER
SAIConference_PAPER
 
An Approach to Software Testing of Machine Learning Applications
An Approach to Software Testing of Machine Learning ApplicationsAn Approach to Software Testing of Machine Learning Applications
An Approach to Software Testing of Machine Learning Applications
 
SBST 2019 Keynote
SBST 2019 Keynote SBST 2019 Keynote
SBST 2019 Keynote
 
Transferring Software Testing Tools to Practice (AST 2017 Keynote)
Transferring Software Testing Tools to Practice (AST 2017 Keynote)Transferring Software Testing Tools to Practice (AST 2017 Keynote)
Transferring Software Testing Tools to Practice (AST 2017 Keynote)
 
Mutation Analysis and Testing for Cyber-Physical Systems: Scalable Solutions...
Mutation Analysis and Testing for Cyber-Physical Systems: Scalable Solutions...Mutation Analysis and Testing for Cyber-Physical Systems: Scalable Solutions...
Mutation Analysis and Testing for Cyber-Physical Systems: Scalable Solutions...
 
Code coverage based test case selection and prioritization
Code coverage based test case selection and prioritizationCode coverage based test case selection and prioritization
Code coverage based test case selection and prioritization
 
Black Box Testing
Black Box TestingBlack Box Testing
Black Box Testing
 
Sta unit 2(abimanyu)
Sta unit 2(abimanyu)Sta unit 2(abimanyu)
Sta unit 2(abimanyu)
 
Finding bugs that matter with Findbugs
Finding bugs that matter with FindbugsFinding bugs that matter with Findbugs
Finding bugs that matter with Findbugs
 
Diversity Maximization Speedup for Fault Localization
Diversity Maximization Speedup for Fault LocalizationDiversity Maximization Speedup for Fault Localization
Diversity Maximization Speedup for Fault Localization
 
Rv11
Rv11Rv11
Rv11
 
Istqb ctfl-series - Black Box Testing
Istqb ctfl-series - Black Box TestingIstqb ctfl-series - Black Box Testing
Istqb ctfl-series - Black Box Testing
 
Amin Milani Fard: Directed Model Inference for Testing and Analysis of Web Ap...
Amin Milani Fard: Directed Model Inference for Testing and Analysis of Web Ap...Amin Milani Fard: Directed Model Inference for Testing and Analysis of Web Ap...
Amin Milani Fard: Directed Model Inference for Testing and Analysis of Web Ap...
 
Software Testing Techniques
Software Testing TechniquesSoftware Testing Techniques
Software Testing Techniques
 
Advances in Unit Testing: Theory and Practice
Advances in Unit Testing: Theory and PracticeAdvances in Unit Testing: Theory and Practice
Advances in Unit Testing: Theory and Practice
 

Viewers also liked

Pino coviello, rodriguez
Pino coviello, rodriguezPino coviello, rodriguez
Pino coviello, rodriguez
alvaropinocoviello
 
Property Based Testing
Property Based TestingProperty Based Testing
Property Based Testing
Shishir Dwivedi
 
Property-based testing
Property-based testingProperty-based testing
Property-based testing
Dmitriy Morozov
 
Property-based testing
Property-based testingProperty-based testing
Property-based testing
Peter Gromov
 
ScalaCheckでProperty-based Testing
ScalaCheckでProperty-based TestingScalaCheckでProperty-based Testing
ScalaCheckでProperty-based Testing
Koji Agawa
 
Property-Based Testing for Services
Property-Based Testing for ServicesProperty-Based Testing for Services
Property-Based Testing for Services
jessitron
 
Property based testing - Less is more
Property based testing - Less is moreProperty based testing - Less is more
Property based testing - Less is more
Ho Tien VU
 
Better Tests, Less Code: Property-based Testing
Better Tests, Less Code: Property-based TestingBetter Tests, Less Code: Property-based Testing
Better Tests, Less Code: Property-based Testing
C4Media
 
Property based Testing - generative data & executable domain rules
Property based Testing - generative data & executable domain rulesProperty based Testing - generative data & executable domain rules
Property based Testing - generative data & executable domain rules
Debasish Ghosh
 
An introduction to property based testing
An introduction to property based testingAn introduction to property based testing
An introduction to property based testing
Scott Wlaschin
 
UNIT TESTING PPT
UNIT TESTING PPTUNIT TESTING PPT
UNIT TESTING PPT
suhasreddy1
 

Viewers also liked (11)

Pino coviello, rodriguez
Pino coviello, rodriguezPino coviello, rodriguez
Pino coviello, rodriguez
 
Property Based Testing
Property Based TestingProperty Based Testing
Property Based Testing
 
Property-based testing
Property-based testingProperty-based testing
Property-based testing
 
Property-based testing
Property-based testingProperty-based testing
Property-based testing
 
ScalaCheckでProperty-based Testing
ScalaCheckでProperty-based TestingScalaCheckでProperty-based Testing
ScalaCheckでProperty-based Testing
 
Property-Based Testing for Services
Property-Based Testing for ServicesProperty-Based Testing for Services
Property-Based Testing for Services
 
Property based testing - Less is more
Property based testing - Less is moreProperty based testing - Less is more
Property based testing - Less is more
 
Better Tests, Less Code: Property-based Testing
Better Tests, Less Code: Property-based TestingBetter Tests, Less Code: Property-based Testing
Better Tests, Less Code: Property-based Testing
 
Property based Testing - generative data & executable domain rules
Property based Testing - generative data & executable domain rulesProperty based Testing - generative data & executable domain rules
Property based Testing - generative data & executable domain rules
 
An introduction to property based testing
An introduction to property based testingAn introduction to property based testing
An introduction to property based testing
 
UNIT TESTING PPT
UNIT TESTING PPTUNIT TESTING PPT
UNIT TESTING PPT
 

Similar to Making property-based testing easier to read for humans

Chapter 10 Testing and Quality Assurance1Unders.docx
Chapter 10 Testing and Quality Assurance1Unders.docxChapter 10 Testing and Quality Assurance1Unders.docx
Chapter 10 Testing and Quality Assurance1Unders.docx
keturahhazelhurst
 
Automation Testing theory notes.pptx
Automation Testing theory notes.pptxAutomation Testing theory notes.pptx
Automation Testing theory notes.pptx
NileshBorkar12
 
Anders Claesson - Test Strategies in Agile Projects - EuroSTAR 2010
Anders Claesson - Test Strategies in Agile Projects - EuroSTAR 2010Anders Claesson - Test Strategies in Agile Projects - EuroSTAR 2010
Anders Claesson - Test Strategies in Agile Projects - EuroSTAR 2010
TEST Huddle
 
Test Driven Development - The art of fearless programming
Test Driven Development - The art of fearless programmingTest Driven Development - The art of fearless programming
Test Driven Development - The art of fearless programming
Chamil Jeewantha
 
Effective unit testing
Effective unit testingEffective unit testing
Effective unit testing
Roberto Casadei
 
Role+Of+Testing+In+Sdlc
Role+Of+Testing+In+SdlcRole+Of+Testing+In+Sdlc
Role+Of+Testing+In+Sdlc
mahendra singh
 
Programming with GUTs
Programming with GUTsProgramming with GUTs
Programming with GUTs
catherinewall
 
Siguccs20101026
Siguccs20101026Siguccs20101026
Siguccs20101026
Takashi Yamanoue
 
B2 2005 introduction_load_testing_blackboard_primer_draft
B2 2005 introduction_load_testing_blackboard_primer_draftB2 2005 introduction_load_testing_blackboard_primer_draft
B2 2005 introduction_load_testing_blackboard_primer_draft
Steve Feldman
 
Introduction to programming with python
Introduction to programming with pythonIntroduction to programming with python
Introduction to programming with python
Porimol Chandro
 
Xp Day 080506 Unit Tests And Mocks
Xp Day 080506 Unit Tests And MocksXp Day 080506 Unit Tests And Mocks
Xp Day 080506 Unit Tests And Mocks
guillaumecarre
 
XP through TDD
XP through TDDXP through TDD
XP through TDD
Mauricio Cappella
 
Software development effort reduction with Co-op
Software development effort reduction with Co-opSoftware development effort reduction with Co-op
Software development effort reduction with Co-op
lbergmans
 
Use Case Workshop
Use Case WorkshopUse Case Workshop
Use Case Workshop
elkensteyin
 
OORPT Dynamic Analysis
OORPT Dynamic AnalysisOORPT Dynamic Analysis
OORPT Dynamic Analysis
lienhard
 
52 - The Impact of Test Ownership and Team Structure on the Reliability and E...
52 - The Impact of Test Ownership and Team Structure on the Reliability and E...52 - The Impact of Test Ownership and Team Structure on the Reliability and E...
52 - The Impact of Test Ownership and Team Structure on the Reliability and E...
ESEM 2014
 
CS2006Ch02A.ppt dfxgbfdcgbhfcdhbfdcbfdcgfdg
CS2006Ch02A.ppt dfxgbfdcgbhfcdhbfdcbfdcgfdgCS2006Ch02A.ppt dfxgbfdcgbhfcdhbfdcbfdcgfdg
CS2006Ch02A.ppt dfxgbfdcgbhfcdhbfdcbfdcgfdg
RahithAhsan1
 
Sdlc
SdlcSdlc
Sdlc
SdlcSdlc
Cs6502 ooad-cse-vst-au-unit-v dce
Cs6502 ooad-cse-vst-au-unit-v dceCs6502 ooad-cse-vst-au-unit-v dce
Cs6502 ooad-cse-vst-au-unit-v dce
tagoreengineering
 

Similar to Making property-based testing easier to read for humans (20)

Chapter 10 Testing and Quality Assurance1Unders.docx
Chapter 10 Testing and Quality Assurance1Unders.docxChapter 10 Testing and Quality Assurance1Unders.docx
Chapter 10 Testing and Quality Assurance1Unders.docx
 
Automation Testing theory notes.pptx
Automation Testing theory notes.pptxAutomation Testing theory notes.pptx
Automation Testing theory notes.pptx
 
Anders Claesson - Test Strategies in Agile Projects - EuroSTAR 2010
Anders Claesson - Test Strategies in Agile Projects - EuroSTAR 2010Anders Claesson - Test Strategies in Agile Projects - EuroSTAR 2010
Anders Claesson - Test Strategies in Agile Projects - EuroSTAR 2010
 
Test Driven Development - The art of fearless programming
Test Driven Development - The art of fearless programmingTest Driven Development - The art of fearless programming
Test Driven Development - The art of fearless programming
 
Effective unit testing
Effective unit testingEffective unit testing
Effective unit testing
 
Role+Of+Testing+In+Sdlc
Role+Of+Testing+In+SdlcRole+Of+Testing+In+Sdlc
Role+Of+Testing+In+Sdlc
 
Programming with GUTs
Programming with GUTsProgramming with GUTs
Programming with GUTs
 
Siguccs20101026
Siguccs20101026Siguccs20101026
Siguccs20101026
 
B2 2005 introduction_load_testing_blackboard_primer_draft
B2 2005 introduction_load_testing_blackboard_primer_draftB2 2005 introduction_load_testing_blackboard_primer_draft
B2 2005 introduction_load_testing_blackboard_primer_draft
 
Introduction to programming with python
Introduction to programming with pythonIntroduction to programming with python
Introduction to programming with python
 
Xp Day 080506 Unit Tests And Mocks
Xp Day 080506 Unit Tests And MocksXp Day 080506 Unit Tests And Mocks
Xp Day 080506 Unit Tests And Mocks
 
XP through TDD
XP through TDDXP through TDD
XP through TDD
 
Software development effort reduction with Co-op
Software development effort reduction with Co-opSoftware development effort reduction with Co-op
Software development effort reduction with Co-op
 
Use Case Workshop
Use Case WorkshopUse Case Workshop
Use Case Workshop
 
OORPT Dynamic Analysis
OORPT Dynamic AnalysisOORPT Dynamic Analysis
OORPT Dynamic Analysis
 
52 - The Impact of Test Ownership and Team Structure on the Reliability and E...
52 - The Impact of Test Ownership and Team Structure on the Reliability and E...52 - The Impact of Test Ownership and Team Structure on the Reliability and E...
52 - The Impact of Test Ownership and Team Structure on the Reliability and E...
 
CS2006Ch02A.ppt dfxgbfdcgbhfcdhbfdcbfdcgfdg
CS2006Ch02A.ppt dfxgbfdcgbhfcdhbfdcbfdcgfdgCS2006Ch02A.ppt dfxgbfdcgbhfcdhbfdcbfdcgfdg
CS2006Ch02A.ppt dfxgbfdcgbhfcdhbfdcbfdcgfdg
 
Sdlc
SdlcSdlc
Sdlc
 
Sdlc
SdlcSdlc
Sdlc
 
Cs6502 ooad-cse-vst-au-unit-v dce
Cs6502 ooad-cse-vst-au-unit-v dceCs6502 ooad-cse-vst-au-unit-v dce
Cs6502 ooad-cse-vst-au-unit-v dce
 

More from Laura M. Castro

Ola, ChatGPT... que carreira sería boa para min?
Ola, ChatGPT... que carreira sería boa para min?Ola, ChatGPT... que carreira sería boa para min?
Ola, ChatGPT... que carreira sería boa para min?
Laura M. Castro
 
IAs xerativas e nesgos de xénero
IAs xerativas e nesgos de xéneroIAs xerativas e nesgos de xénero
IAs xerativas e nesgos de xénero
Laura M. Castro
 
As intelixencias artificiais como xeradoras de cultura: exploración dos nesgo...
As intelixencias artificiais como xeradoras de cultura: exploración dos nesgo...As intelixencias artificiais como xeradoras de cultura: exploración dos nesgo...
As intelixencias artificiais como xeradoras de cultura: exploración dos nesgo...
Laura M. Castro
 
David vs. Goliat: lecciones aprendidas de una experiencia fallida de adopción...
David vs. Goliat: lecciones aprendidas de una experiencia fallida de adopción...David vs. Goliat: lecciones aprendidas de una experiencia fallida de adopción...
David vs. Goliat: lecciones aprendidas de una experiencia fallida de adopción...
Laura M. Castro
 
Why on Earth would I test if I have to just "Let it crash"?
Why on Earth would I test if I have to just "Let it crash"?Why on Earth would I test if I have to just "Let it crash"?
Why on Earth would I test if I have to just "Let it crash"?
Laura M. Castro
 
How the BEAM will change your mind
How the BEAM will change your mindHow the BEAM will change your mind
How the BEAM will change your mind
Laura M. Castro
 
Elixir vs Java
Elixir vs JavaElixir vs Java
Elixir vs Java
Laura M. Castro
 
So I used Erlang... is my system as scalable as they say it'd be?
So I used Erlang... is my system as scalable as they say it'd be?So I used Erlang... is my system as scalable as they say it'd be?
So I used Erlang... is my system as scalable as they say it'd be?
Laura M. Castro
 
Elixir: the not-so-hidden path to Erlang
Elixir: the not-so-hidden path to ErlangElixir: the not-so-hidden path to Erlang
Elixir: the not-so-hidden path to Erlang
Laura M. Castro
 
Automatic generation of UML sequence diagrams from test counterexamples
Automatic generation of UML sequence diagrams from test counterexamplesAutomatic generation of UML sequence diagrams from test counterexamples
Automatic generation of UML sequence diagrams from test counterexamples
Laura M. Castro
 
Erlang as a supporting technology for teaching Software Architecture
Erlang as a supporting technology for teaching Software ArchitectureErlang as a supporting technology for teaching Software Architecture
Erlang as a supporting technology for teaching Software Architecture
Laura M. Castro
 
A Backpack to go the Extra-Functional Mile (a hitched hike by the PROWESS pro...
A Backpack to go the Extra-Functional Mile (a hitched hike by the PROWESS pro...A Backpack to go the Extra-Functional Mile (a hitched hike by the PROWESS pro...
A Backpack to go the Extra-Functional Mile (a hitched hike by the PROWESS pro...
Laura M. Castro
 
Experiencias Industriales con Programación Declarativa
Experiencias Industriales con Programación DeclarativaExperiencias Industriales con Programación Declarativa
Experiencias Industriales con Programación Declarativa
Laura M. Castro
 
Functional programming goes to Hollywood... and around the world!
Functional programming goes to Hollywood... and around the world!Functional programming goes to Hollywood... and around the world!
Functional programming goes to Hollywood... and around the world!
Laura M. Castro
 
Failover and takeover contingency mechanisms for network partition and node f...
Failover and takeover contingency mechanisms for network partition and node f...Failover and takeover contingency mechanisms for network partition and node f...
Failover and takeover contingency mechanisms for network partition and node f...
Laura M. Castro
 
Editing documents with LaTeX
Editing documents with LaTeXEditing documents with LaTeX
Editing documents with LaTeX
Laura M. Castro
 
Introdución á edición de textos con LaTeX
Introdución á edición de textos con LaTeXIntrodución á edición de textos con LaTeX
Introdución á edición de textos con LaTeX
Laura M. Castro
 
Edición de textos con LaTeX
Edición de textos con LaTeXEdición de textos con LaTeX
Edición de textos con LaTeX
Laura M. Castro
 
Edición de textos con LaTeX
Edición de textos con LaTeXEdición de textos con LaTeX
Edición de textos con LaTeX
Laura M. Castro
 
Improving software development using Erlang/OTP
Improving software development using Erlang/OTPImproving software development using Erlang/OTP
Improving software development using Erlang/OTP
Laura M. Castro
 

More from Laura M. Castro (20)

Ola, ChatGPT... que carreira sería boa para min?
Ola, ChatGPT... que carreira sería boa para min?Ola, ChatGPT... que carreira sería boa para min?
Ola, ChatGPT... que carreira sería boa para min?
 
IAs xerativas e nesgos de xénero
IAs xerativas e nesgos de xéneroIAs xerativas e nesgos de xénero
IAs xerativas e nesgos de xénero
 
As intelixencias artificiais como xeradoras de cultura: exploración dos nesgo...
As intelixencias artificiais como xeradoras de cultura: exploración dos nesgo...As intelixencias artificiais como xeradoras de cultura: exploración dos nesgo...
As intelixencias artificiais como xeradoras de cultura: exploración dos nesgo...
 
David vs. Goliat: lecciones aprendidas de una experiencia fallida de adopción...
David vs. Goliat: lecciones aprendidas de una experiencia fallida de adopción...David vs. Goliat: lecciones aprendidas de una experiencia fallida de adopción...
David vs. Goliat: lecciones aprendidas de una experiencia fallida de adopción...
 
Why on Earth would I test if I have to just "Let it crash"?
Why on Earth would I test if I have to just "Let it crash"?Why on Earth would I test if I have to just "Let it crash"?
Why on Earth would I test if I have to just "Let it crash"?
 
How the BEAM will change your mind
How the BEAM will change your mindHow the BEAM will change your mind
How the BEAM will change your mind
 
Elixir vs Java
Elixir vs JavaElixir vs Java
Elixir vs Java
 
So I used Erlang... is my system as scalable as they say it'd be?
So I used Erlang... is my system as scalable as they say it'd be?So I used Erlang... is my system as scalable as they say it'd be?
So I used Erlang... is my system as scalable as they say it'd be?
 
Elixir: the not-so-hidden path to Erlang
Elixir: the not-so-hidden path to ErlangElixir: the not-so-hidden path to Erlang
Elixir: the not-so-hidden path to Erlang
 
Automatic generation of UML sequence diagrams from test counterexamples
Automatic generation of UML sequence diagrams from test counterexamplesAutomatic generation of UML sequence diagrams from test counterexamples
Automatic generation of UML sequence diagrams from test counterexamples
 
Erlang as a supporting technology for teaching Software Architecture
Erlang as a supporting technology for teaching Software ArchitectureErlang as a supporting technology for teaching Software Architecture
Erlang as a supporting technology for teaching Software Architecture
 
A Backpack to go the Extra-Functional Mile (a hitched hike by the PROWESS pro...
A Backpack to go the Extra-Functional Mile (a hitched hike by the PROWESS pro...A Backpack to go the Extra-Functional Mile (a hitched hike by the PROWESS pro...
A Backpack to go the Extra-Functional Mile (a hitched hike by the PROWESS pro...
 
Experiencias Industriales con Programación Declarativa
Experiencias Industriales con Programación DeclarativaExperiencias Industriales con Programación Declarativa
Experiencias Industriales con Programación Declarativa
 
Functional programming goes to Hollywood... and around the world!
Functional programming goes to Hollywood... and around the world!Functional programming goes to Hollywood... and around the world!
Functional programming goes to Hollywood... and around the world!
 
Failover and takeover contingency mechanisms for network partition and node f...
Failover and takeover contingency mechanisms for network partition and node f...Failover and takeover contingency mechanisms for network partition and node f...
Failover and takeover contingency mechanisms for network partition and node f...
 
Editing documents with LaTeX
Editing documents with LaTeXEditing documents with LaTeX
Editing documents with LaTeX
 
Introdución á edición de textos con LaTeX
Introdución á edición de textos con LaTeXIntrodución á edición de textos con LaTeX
Introdución á edición de textos con LaTeX
 
Edición de textos con LaTeX
Edición de textos con LaTeXEdición de textos con LaTeX
Edición de textos con LaTeX
 
Edición de textos con LaTeX
Edición de textos con LaTeXEdición de textos con LaTeX
Edición de textos con LaTeX
 
Improving software development using Erlang/OTP
Improving software development using Erlang/OTPImproving software development using Erlang/OTP
Improving software development using Erlang/OTP
 

Recently uploaded

Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
fredae14
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Jeffrey Haguewood
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 

Recently uploaded (20)

Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 

Making property-based testing easier to read for humans

  • 1. Making property-based testing easier to read for humans Laura M. Castro February 18th, 2016
  • 2. Stakeholder involvement & software testing The challenge of communication Active stakeholder participation is an agile best practice1 Early testing is also an agile best practice1 1 Agile practices are considered mainstream, with adoption rates ≈50%2 of 30
  • 3. Stakeholder involvement & software testing The challenge of communication Active stakeholder participation is an agile best practice1 stakeholder involvement requires inclusive modeling (UML activity diagrams, user stories) Early testing is also an agile best practice1 best represented by Test-Driven Development (TDD) 1 Agile practices are considered mainstream, with adoption rates ≈50%2 of 30
  • 4. Stakeholder involvement & software testing The challenge of communication Active stakeholder participation is an agile best practice1 stakeholder involvement requires inclusive modeling (UML activity diagrams, user stories) Early testing is also an agile best practice1 best represented by Test-Driven Development (TDD) stakeholder involvement + early testing = Behaviour-Driven Development (BDD) 1 Agile practices are considered mainstream, with adoption rates ≈50%2 of 30
  • 5. Behaviour-Driven Development Feature: Deletion of element from list In order to operate lists As a user of the lists module I want to delete an element from a list Scenario: Delete integer from list of integers Given I have the integer 3 And I have the list of integers [0,8,6] When I use the function lists:delete/2 Then the resulting list should not contain 3 3 of 30
  • 6. Behaviour-Driven Development The behaviour becomes test case given("I have the integer (d+)", S, [Num]) -> {ok, S ++ [list_to_integer(Num)]}; ... when("I use the function (w+) from the module (w+)", S, [F, M]) -> {ok, apply(list_to_atom(M), list_to_atom(F), S)}. then("the resulting list should not contain (d+)", S, [Num]) -> case not lists:member(list_to_integer(Num), S) of true -> {ok, S}; false -> {failed, S} end. 4 of 30
  • 9. Behaviour-Driven Development Pros and cons Good as communication tool a number of implementations in many languages: C++, Clojure, Erlang, Java, JavaScript, Lua, .NET, PHP,… Not as good as testing tool run as many test cases as you can write well-known problems of “traditional” testing: specification, implementation, maintainability, effectiveness 7 of 30
  • 10. Property-Based Testing (PBT) Strategy for improved testing: abstraction + automation write properties instead of test cases properties are used to automatically generate, run, and diagnose many, many test cases 8 of 30
  • 11. Property-Based Testing A very simple example How do you write properties? Let’s start simple: Example: delete an element from a list 9 of 30
  • 12. Property-Based Testing A very simple example How do you write properties? Let’s start simple: Example: delete an element from a list Desired functionality? If I delete an element from a list, it shouldn't be there anymore. 9 of 30
  • 13. Property-Based Testing A very simple example How do you write properties? Let’s start simple: Example: delete an element from a list Desired functionality? If I delete an element from a list, it shouldn't be there anymore. Which item? Which list? Any. 9 of 30
  • 14. Property-Based Testing A very simple example prop_simple() -> ?FORALL(I, item(), ?FORALL(L, list(item()), not lists:member(I, lists:delete(I, L)))). 10 of 30
  • 15. Property-Based Testing A very simple example prop_simple() -> ?FORALL(I, item(), ?FORALL(L, list(item()), not lists:member(I, lists:delete(I, L)))). 11 of 30
  • 16. Property-Based Testing A very simple example prop_simple() -> ?FORALL(I, item(), ?FORALL(L, list(item()), not lists:member(I, lists:delete(I, L)))). 12 of 30
  • 17. Property-Based Testing A very simple example prop_simple() -> ?FORALL(I, item(), ?FORALL(L, list(item()), [] == [ X || X <- lists:delete(I, L), X == I])). 13 of 30
  • 18. Property-Based Testing A very simple example prop_simple() -> ?FORALL(I, item(), ?FORALL(L, list(item()), not lists:member(I, lists:delete(I, L)))). 14 of 30
  • 19. Property-Based Testing A very simple example > eqc:quickcheck(simple_eqc:prop_simple()). ................................................ ................................................ .... OK, passed 100 tests 15 of 30
  • 20. Property-Based Testing A very simple example > eqc:quickcheck(simple_eqc:prop_simple()). ................................................ .................... Failed! After 69 tests. 15 [-13,-15,-2,-17,-20,15,15] Shrinking xxxxxxxx.xx.xxxxxxxx (2 times) 15 [15,15] 16 of 30
  • 21. Property-Based Testing A more complex example How complex can it get? Models for stateful components. Example: EVM registry register(Name, Pid) -> ok unregister(Name) -> ok whereis(Name) -> Pid | undefined 17 of 30
  • 22. Property-Based Testing A more complex example How complex can it get? Models for stateful components. Example: EVM registry register(Name, Pid) -> ok unregister(Name) -> ok whereis(Name) -> Pid | undefined Desired functionality? If I perform a sequence of registry actions, I expect compliance with model at all times. 17 of 30
  • 23. Property-Based Testing A more complex example How complex can it get? Models for stateful components. Example: EVM registry register(Name, Pid) -> ok unregister(Name) -> ok whereis(Name) -> Pid | undefined Desired functionality? If I perform a sequence of registry actions, I expect compliance with model at all times. Which sequences of actions? Any. 17 of 30
  • 24. Property-Based Testing A more complex example prop_registry() -> ?FORALL(Cmds, commands(registry_model), begin ... % setup code {H, S, TResult} = run_commands(registry_model,Cmds), ... % cleanup code TResult == ok end). 18 of 30
  • 25. Property-Based Testing A more complex example prop_registry() -> ?FORALL(Cmds, commands(registry_model), begin ... % setup code {H, S, TResult} = run_commands(registry_model,Cmds), ... % cleanup code TResult == ok end). 19 of 30
  • 26. Property-Based Testing A more complex example register_pre(S) -> S#state.pids /= []. ... unregister_next(S,_,[Name]) -> S#state{regs = lists:keydelete(Name,1,S#state.regs)}. ... whereis_post(S, [Name], Result) -> case lists:keyfind(Name, 1, S#state.regs) of {Name,Value} -> Res =:= Value; false -> Res =:= undefined end. 20 of 30
  • 27. Property-Based Testing Pros and cons Good as testing tool run as many test cases as you have time to execute run different test cases every time get reduced counterexamples, for focused debugging get a functional specification of the software a number of implementations in many languages: Clojure, Lisp, Erlang, ML, Prolog, Scala, Scheme, Smalltalk,… Not as good as communication tool 21 of 30
  • 28. readSpec making PBT easier to read for humans Get (semi)natural language descriptions for sample test cases that test properties produce 1. Write PBT artifacts (properties, models) 2. Get readSpec to translate them into cucumber-like features implemented in Erlang uses Quviq QuickCheck’s coverage-based suite generation Available at: https://github.com/prowessproject/readspec 22 of 30
  • 29. readSpec A very simple example: what do you get? File: simple.feature FEATURE: simple Simple QuickCheck properties ... SCENARIO: Deleting an integer from a list should result in a list that does not contain that integer. GIVEN I have the integer 6 AND I have the list [-1, 2, 13, 0, 5] THEN IS FALSE THAT the integer 6 is in the result of calling lists:delete/2 with 6 and [-1, 2, 13, 0, 5]. ... 23 of 30
  • 30. readSpec A very simple example: what do you get? File: prop_simple.counterexample.feature GIVEN I have the integer 15 AND I have the list [15, 15] THEN the integer 15 is in the result of calling lists:delete/2 with 15 and [15, 15]. 24 of 30
  • 31. readSpec A very simple example: what do you get? ********************************************************** CALL: register/2 ********************************************************** POSSIBILITIES ... ================================ *** REQUIREMENTS *** [*] The field called "pids" must be equal to the empty list *** RESULT *** the literal 'false' ================================ OTHERWISE ... ================================ *** RESULT *** the literal 'true' 25 of 30
  • 32. VoDKATV: industrial pilot study 26 of 30
  • 33. VoDKATV: industrial pilot study Research questions RQ 1) Can readSpec produce efficient text representations of test properties? RQ 2) Are readSpec text representations an effective way to communicate among stakeholders? 27 of 30
  • 34. VoDKATV: industrial pilot study Measurements RQ 1) Amount of time to generate the textual representation RQ 1) LOC of textual representations w.r.t. LOC of corresponding test properties/models RQ 2) Stakeholders average rating of usefulness (would use them instead of current way of communic.?) RQ 2) Stakeholders average rating of usability (appropriate? easy to understand/follow?) 28 of 30
  • 35. VoDKATV: industrial pilot study Results Amount of time needed in the order of milliseconds Nature of output (verbosity, number of lines) appropriate Simple cases: high degree of influence of personal skills and background on deeming text more helpful than property code Complex cases: some people still cannot make sense of either; the rest consistently agree the text is more helpful enough to provide the insights needed to suggest more tests! 29 of 30
  • 36. readSpec: making PBT easier to read for humans Final quotes “readSpec looks human-friendly” “simple cases are too verbose for tech people (code is shorter)” “helps in understanding tests better, especially when they’re complex” “it’s interesting when cases reach certain complexity” “presents requirements in an explicit way, that can slip your mind o/w” “this is very helpful for people who are not familiar with the code” “only with a good level of maturity and experience one could be more comfortable with QC properties and models” 30 of 30