Testing, CI and CD in the real world
-
Upload
roc-boronat -
Category
Engineering
-
view
648 -
download
2
Transcript of Testing, CI and CD in the real world
![Page 1: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/1.jpg)
Testing continous Integration continous Delivery
…in the real world!
![Page 2: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/2.jpg)
Roc Boronat I develop Android things
– I wanna learn about testing! – Roc 2014
![Page 3: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/3.jpg)
tests introducing
![Page 4: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/4.jpg)
unitary tests
integration tests
instrumentation tests
![Page 5: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/5.jpg)
we started with unitary tests to
develop regular expressions
^[6789]{1}[0-9]{8}$ ^0{2}[0-9]{11,}
![Page 6: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/6.jpg)
we started with unitary tests to
develop regular expressions
![Page 7: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/7.jpg)
we started with unitary tests to
develop regular expressions
![Page 8: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/8.jpg)
we started with unitary tests to
develop regular expressions
![Page 9: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/9.jpg)
we started with unitary tests to
develop regular expressions
given when then
given when then
![Page 10: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/10.jpg)
we started with unitary tests to
parse deeplink URL’s
this happens at
![Page 11: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/11.jpg)
we started with unitary tests to
parse deeplink URL’s
this happens at
![Page 12: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/12.jpg)
we started with unitary tests to
parse deeplink URL’s
this happens at
![Page 13: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/13.jpg)
we started with unitary tests to
improve an invoice generator
Customer can have a insurance… or not The insurance can have a coverage limit… or not The insurance can have a franchise deductible… or not The insurance company can pay the VAT of the amount… or not
![Page 14: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/14.jpg)
we started with unitary tests to
improve an invoice generator
![Page 15: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/15.jpg)
we started with unitary tests to
improve an invoice generator
![Page 16: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/16.jpg)
we started with unitary tests to
refactor legacy code
this happens at
![Page 17: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/17.jpg)
we started with unitary tests to
refactor legacy code
Sandro Mancuso craftedws.blogspot.com
Testing and Refactoring Legacy Code youtu.be/_NnElPO5BU0
Legacy Code Rules
• You cannot change production code if not covered by tests … just automated refactorings (via IDE) are allowed, if needed to write the test
this happens at
![Page 18: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/18.jpg)
we started with unitary tests to
refactor legacy code
Sandro Mancuso craftedws.blogspot.com
Testing and Refactoring Legacy Code youtu.be/_NnElPO5BU0
this happens at
![Page 19: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/19.jpg)
last tips about unitary tests
follow the given-when-then style
test one thing at a time
test the domain: is easy and valuable
frustration is the first step towards improvement
know the tools: JUnit + AssertJ + Mockito
![Page 20: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/20.jpg)
unitary tests
integration tests
instrumentation tests
![Page 21: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/21.jpg)
we started with integration test to
develop an API module
this happens at
quit smoking with your phone
![Page 22: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/22.jpg)
tips about integration tests
develop the API module by TDD
check that your customer’s API has not changed
monitor your own API using a CI tool
![Page 23: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/23.jpg)
unitary tests
integration tests
instrumentation tests
![Page 24: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/24.jpg)
we started with instrumentation test to
test an app end to end
this happens at
![Page 25: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/25.jpg)
we started with instrumentation test to
test an app end to end
this happens at
![Page 26: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/26.jpg)
we started with instrumentation test to
test an app end to end
this happens at
![Page 27: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/27.jpg)
tips about instrumentation tests
simple way to do «defensive testing»
fast way to develop «deep screens»
Espresso has been a game changer
They use to fail at CI tools
![Page 28: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/28.jpg)
extra point: TDD test-driven development
![Page 29: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/29.jpg)
extra point: TDD test-driven development
![Page 30: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/30.jpg)
extra point 2: EDD? error-driven development
Someone found a bug?
Write a test that reproduces it before fixing it!
![Page 31: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/31.jpg)
extra point 2: EDD? error-driven development
this happens at
![Page 32: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/32.jpg)
continous * introducing
![Page 33: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/33.jpg)
continous integration
continous delivery
![Page 34: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/34.jpg)
we started with continous integration to
fail fast
this happens at
quit smoking with your phone
![Page 35: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/35.jpg)
we started with continous integration to
fail fast
this happens at
quit smoking with your phone
![Page 36: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/36.jpg)
we started with continous integration to
maintain code quality
this happens at
![Page 37: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/37.jpg)
we started with continous integration to
maintain code quality
this happens at
![Page 38: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/38.jpg)
continous integration
continous delivery
![Page 39: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/39.jpg)
we started with continous delivery to
launch releases from SourceTree
Group of Betatesters 0,5% of users
this happens at
quit smoking with your phone
![Page 40: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/40.jpg)
we started with continous delivery to
update stakeholders
the product owners have the last developed feature
in their phones
this happens at
![Page 41: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/41.jpg)
we started with continous delivery to
launch releases from Terminal
Group of Betatesters Alpha Release
this happens at
![Page 42: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/42.jpg)
![Page 43: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/43.jpg)
![Page 44: Testing, CI and CD in the real world](https://reader034.fdocuments.in/reader034/viewer/2022051520/589cbf461a28ab8b018b5515/html5/thumbnails/44.jpg)
Roc Boronat [email protected]