TDD in iOS Development by examples Marko Čičak Igor Stojanović.
-
Upload
maude-stafford -
Category
Documents
-
view
245 -
download
0
Transcript of TDD in iOS Development by examples Marko Čičak Igor Stojanović.
![Page 1: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/1.jpg)
TDDin
iOSDevelopment
by examples
Marko ČičakIgor Stojanović
![Page 2: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/2.jpg)
AGENDA1: TDD - how we started with
2: A full cup of TDD
3: Conclusion
4: Questions
![Page 3: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/3.jpg)
TDD – HOW WE STARTED
- Java testing tools:
- JUnit
- TestNG
- Checkstyle
- FindBugs
- DbUnit
- Sonar
......
![Page 4: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/4.jpg)
TDD – HOW WE STARTED
- Do you write tests for your iOS applications?
“The best testing is when I see how application works on my mobile device.”
![Page 5: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/5.jpg)
MOBILE DEV. IS HARDComplex applications
![Page 6: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/6.jpg)
MOBILE DEV. IS HARDLots of code
![Page 7: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/7.jpg)
MOBILE DEV. IS HARDSmooth scrolling
![Page 8: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/8.jpg)
MOBILE DEV. IS HARDOffline mode
![Page 9: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/9.jpg)
MOBILE DEV. IS HARDState restoration
![Page 10: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/10.jpg)
MOBILE DEV. IS HARD
![Page 11: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/11.jpg)
MOBILE DEV. IS HARD
- Lots of code.
- No tests.
- Hard to develop and maintain.
- “It doesn’t work but it worked in previous versions.”
- Why didn’t you write tests?
“We didn’t have time”
![Page 12: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/12.jpg)
TDD – HOW WE STARTEDNovember 2013 – CenterDevice iPhone client
- How to test?
- KIF, Frank, Appium, Zucchini, Calabash, UIAutomation...
- Guidelines:
Objective-C
Small learning curve
Easy to write and maintain
Fast execution
![Page 13: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/13.jpg)
TDD – HOW WE STARTEDNovember 2013 – CenterDevice iPhone client
![Page 14: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/14.jpg)
TDD – HOW WE STARTED
![Page 15: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/15.jpg)
TDD
![Page 16: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/16.jpg)
APP DEMO
![Page 17: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/17.jpg)
TDD – NEW PROJECT
![Page 18: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/18.jpg)
TDD – NEW PROJECT
![Page 19: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/19.jpg)
TDD – NEW PROJECT
![Page 20: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/20.jpg)
TDD – NEW PROJECT
![Page 21: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/21.jpg)
![Page 22: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/22.jpg)
![Page 23: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/23.jpg)
![Page 24: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/24.jpg)
![Page 25: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/25.jpg)
![Page 26: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/26.jpg)
TEST APP DELEGATE
![Page 27: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/27.jpg)
TEST APP DELEGATE
![Page 28: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/28.jpg)
TEST APP DELEGATE
![Page 29: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/29.jpg)
TEST APP DELEGATE
![Page 30: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/30.jpg)
TEST APP DELEGATE
![Page 31: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/31.jpg)
TEST APP DELEGATE
![Page 32: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/32.jpg)
SINGLETONS
![Page 33: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/33.jpg)
SINGLETONS
![Page 34: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/34.jpg)
SINGLETONS
![Page 35: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/35.jpg)
SINGLETONS
![Page 36: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/36.jpg)
XCTESTCASE
![Page 37: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/37.jpg)
![Page 38: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/38.jpg)
VIEW MODEL
![Page 39: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/39.jpg)
VIEW MODEL
![Page 40: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/40.jpg)
VIEW MODEL
![Page 41: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/41.jpg)
VIEW MODEL
![Page 42: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/42.jpg)
VIEW MODEL
![Page 43: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/43.jpg)
CORE DATA
![Page 44: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/44.jpg)
CORE DATA
![Page 45: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/45.jpg)
CORE DATA
![Page 46: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/46.jpg)
DATA PROVIDER
![Page 47: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/47.jpg)
DATA PROVIDER
![Page 48: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/48.jpg)
![Page 49: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/49.jpg)
![Page 50: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/50.jpg)
DATA PROVIDER
![Page 51: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/51.jpg)
DATA PROVIDER
![Page 52: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/52.jpg)
PROBLEM WITH ANIMATIONS
![Page 53: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/53.jpg)
PROBLEM WITH ANIMATIONS
![Page 54: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/54.jpg)
PROBLEM WITH ANIMATIONSWhat’s wrong with this code?
![Page 55: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/55.jpg)
PROBLEM WITH ANIMATIONS
![Page 56: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/56.jpg)
PROBLEM WITH ANIMATIONS
![Page 57: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/57.jpg)
LOCALISATION
![Page 58: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/58.jpg)
LOCALISATION
![Page 59: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/59.jpg)
LOCALISATION
![Page 60: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/60.jpg)
MODAL VIEWS
![Page 61: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/61.jpg)
MODAL VIEWS
![Page 62: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/62.jpg)
MODAL VIEWS
![Page 63: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/63.jpg)
ALERT VIEWS
![Page 64: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/64.jpg)
ALERT VIEWS
![Page 65: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/65.jpg)
BENEFITS
- Early recognition if something is missing or not well specified.
- Tells you whether your last change or refactoring broke existing functionality.
- Prevents regression and future bugs
- New developer can figure out business logic through tests.
- Less time spent in debugging.
- Forces you to write small classes etc...
![Page 66: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/66.jpg)
DISADVANTAGES
- It’s not trivial to learn because we didn’t used to write tests firsts.
- Could impact design.
- Code refactoring may impact tests.
- Can be short sighted.
![Page 67: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/67.jpg)
OTHER TOOLS FOR TDD
- Expecta – XCTest extension
- OCMock – Helper for easier creation of stub objects
- Specta – TDD/BDD framework for Objective-C
- FBSnapshotTestCase – Snapshot view unit tests for iOS
- OCHamcrest - Hamcrest for Objective-C
- OCMockito
.....
![Page 68: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/68.jpg)
CONCLUSIONTDD IS ONE MORE TOOL
IN YOUR DEVELOPER TOOLBOX
![Page 69: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/69.jpg)
TESTING TOOLS
- KIF - https://github.com/kif-framework/KIF
- Zucchini - https://github.com/playup/zucchini
- Appium - http://appium.io
- Calabash - https://github.com/calabash/calabash-ios
- OCMock - http://ocmock.org
- Expecta - https://github.com/specta/expecta
- Specta - https://github.com/specta/specta
- FBSnapshotTestCase - https://github.com/facebook/ios-snapshot-test-case
- OCHamcrest - https://github.com/hamcrest/OCHamcrest
- OCMockito - https://github.com/jonreid/OCMockito
![Page 70: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/70.jpg)
INTERESTING READ- Test-Driven iOS Developmet by Graham Lee
http://www.amazon.com/Test-Driven-iOS-Development-Developers-Library/dp/0321774183
- Test-Driven Development by Example by Kent Beck
http://www.amazon.com/Test-Driven-Development-By-Example/dp/0321146530
- Pseudo-Localization for Cocoa Apps – blog by Daniel Schneller
https://blog.codecentric.de/en/2013/10/pseudo-localization-cocoa-apps/
- Test-driven development - wikipedia
http://en.wikipedia.org/wiki/Test-driven_development
- Unit Testing Notification Observing on iOS – blog by Nikola Lajic
https://blog.codecentric.de/en/2014/09/unit-testing-notification-observing-ios/
![Page 71: TDD in iOS Development by examples Marko Čičak Igor Stojanović.](https://reader035.fdocuments.net/reader035/viewer/2022081418/5697bfc61a28abf838ca75f3/html5/thumbnails/71.jpg)
QUESTIONS