PropErty based testing
-
Upload
enriquepazperez -
Category
Technology
-
view
187 -
download
2
description
Transcript of PropErty based testing
![Page 2: PropErty based testing](https://reader033.fdocuments.net/reader033/viewer/2022051820/55388e2a550346b04c8b47a9/html5/thumbnails/2.jpg)
Goals of the day
• Underestanding DOs and DON’Ts of PBT• Formulating your own properties for pure functions• Designing and generating test data sets on the fly• And making you eager for more!
2/10
![Page 3: PropErty based testing](https://reader033.fdocuments.net/reader033/viewer/2022051820/55388e2a550346b04c8b47a9/html5/thumbnails/3.jpg)
Goals of the day
• Underestanding DOs and DON’Ts of PBT• Formulating your own properties for pure functions• Designing and generating test data sets on the fly• And making you eager for more!
2/10
![Page 4: PropErty based testing](https://reader033.fdocuments.net/reader033/viewer/2022051820/55388e2a550346b04c8b47a9/html5/thumbnails/4.jpg)
Goals of the day
• Underestanding DOs and DON’Ts of PBT• Formulating your own properties for pure functions• Designing and generating test data sets on the fly• And making you eager for more!
2/10
![Page 5: PropErty based testing](https://reader033.fdocuments.net/reader033/viewer/2022051820/55388e2a550346b04c8b47a9/html5/thumbnails/5.jpg)
Goals of the day
• Underestanding DOs and DON’Ts of PBT• Formulating your own properties for pure functions• Designing and generating test data sets on the fly• And making you eager for more!
2/10
![Page 6: PropErty based testing](https://reader033.fdocuments.net/reader033/viewer/2022051820/55388e2a550346b04c8b47a9/html5/thumbnails/6.jpg)
Property Based Testing Training Setup
• github.com/spilgames/PropEr@ErlangDCRB13I README.mdI Makefile + rebarI src/ with source and propertiesI test/*_eunit.erl as test controllers
3/10
![Page 7: PropErty based testing](https://reader033.fdocuments.net/reader033/viewer/2022051820/55388e2a550346b04c8b47a9/html5/thumbnails/7.jpg)
Property Based Testing The Idea
• What properties should hold?• Properties document your code• Properties generate the testcases• Shrinking towards the smallest input that crashes
4/10
![Page 8: PropErty based testing](https://reader033.fdocuments.net/reader033/viewer/2022051820/55388e2a550346b04c8b47a9/html5/thumbnails/8.jpg)
Property Based Testing The Idea
• What properties should hold?• Properties document your code• Properties generate the testcases• Shrinking towards the smallest input that crashes
4/10
![Page 9: PropErty based testing](https://reader033.fdocuments.net/reader033/viewer/2022051820/55388e2a550346b04c8b47a9/html5/thumbnails/9.jpg)
Property Based Testing The Idea
• What properties should hold?• Properties document your code• Properties generate the testcases• Shrinking towards the smallest input that crashes
4/10
![Page 10: PropErty based testing](https://reader033.fdocuments.net/reader033/viewer/2022051820/55388e2a550346b04c8b47a9/html5/thumbnails/10.jpg)
Property Based Testing The Idea
• What properties should hold?• Properties document your code• Properties generate the testcases• Shrinking towards the smallest input that crashes
4/10
![Page 11: PropErty based testing](https://reader033.fdocuments.net/reader033/viewer/2022051820/55388e2a550346b04c8b47a9/html5/thumbnails/11.jpg)
Property Based Testing Available Tools
• Open Source• Plenty of documentation• Using & contributing via Github
• Available for multiple languages• Trainings and support (at a price)• Pulse for concurrency issues
5/10
![Page 12: PropErty based testing](https://reader033.fdocuments.net/reader033/viewer/2022051820/55388e2a550346b04c8b47a9/html5/thumbnails/12.jpg)
Hands On! A Property
6/10
![Page 13: PropErty based testing](https://reader033.fdocuments.net/reader033/viewer/2022051820/55388e2a550346b04c8b47a9/html5/thumbnails/13.jpg)
Conclusions The Stuff You’re Supposed To Remember
• Start with simple tests• Think properties• Always test your generators first• Test a reasonable success/error rate
7/10
![Page 14: PropErty based testing](https://reader033.fdocuments.net/reader033/viewer/2022051820/55388e2a550346b04c8b47a9/html5/thumbnails/14.jpg)
Conclusions A Practical View
• Property Driven Development is not a thingI Thinking properties is hardI Refactoring properties is hardI Manual basic testcases help you think
• Naming is essential• Avoid reimplementating + comparing• PBT finds stuff you’d never think of
8/10
![Page 15: PropErty based testing](https://reader033.fdocuments.net/reader033/viewer/2022051820/55388e2a550346b04c8b47a9/html5/thumbnails/15.jpg)
Conclusions A Practical View
• Property Driven Development is not a thingI Thinking properties is hardI Refactoring properties is hardI Manual basic testcases help you think
• Naming is essential• Avoid reimplementating + comparing• PBT finds stuff you’d never think of
8/10
![Page 16: PropErty based testing](https://reader033.fdocuments.net/reader033/viewer/2022051820/55388e2a550346b04c8b47a9/html5/thumbnails/16.jpg)
Conclusions More Info
• PropEr @github• PropEr Docs• Quickcheck For Erlang• Concuerror @github• Concuerror Presentation
9/10