Pragmatic Approaches to TDD, UITesting and Playground-Driven Development
It took me a while to immerse myself in the UITesting world - mostly because my fundamental IDE is in a permanent state of flux. Xcode makes solving so many tedious tasks a button click away, but you can still find yourself at a loss when it loses track of where it is...
I don't want you to become discouraged and give up - as I did more than once... So I hope these "Celebrity Testimonials" will help convince you to "stay the course" and break through those initial roadblocks to successful UI testing and Test-Driven Development
WWDC 2015 Session 406 https://developer.apple.com/videos/play/wwdc2015/406/
WWDC 2018 Session 403 https://developer.apple.com/videos/play/wwdc2018/403/
WWDC 2019 Session 413 https://developer.apple.com/videos/play/wwdc2019/413/
Here's 406 on YouTube (in case you don't have a developer account)
WWDC 2015 Session 406 https://www.youtube.com/watch?v=7zMGf-0OnoU
Obviously, these presenters know what they're talking about! If you're already convinced that UITesting makes sense for you, then this is the best place to start.
However, if you need a bit of encouragement, then check out what others have to say about the topic ...
SwiftTalk https://talk.objc.io
Incremental Programming https://www.youtube.com/watch?v=dcqWlEaw58M
Hands-Down this is my favorite VLog. I can't recommend SwiftTalk enough. Check it out - watch a few of the free videos to get a feel for their approach. What I most enjoy about their approach is they promote a process. Get an idea down, express it in code, verify it works, make it more flexible/useful and clean things up so it can be reused. Nothing is ever written in stone.
Playground Driven Development https://talk.objc.io/episodes/S01E51-playground-driven-development
Here's a great example of a SwiftTalk episode with a guest speaker. Brandon explains the benefits of using Playgrounds for quick updates of UI layout with immediate visual confirmation. He makes a convincing argument for adding Playgrounds to your bag of tricks.
UI Testing Cheat Sheet https://www.hackingwithswift.com/articles/148/xcode-ui-testing-cheat-sheet
My hunch is that Paul gets about three hours of sleep a day. I just don't see how he can get so much done, otherwise. A hallmark of his work is that he constantly brings his products up to date. And he explains things very well.
Test Drive Development https://talk.objc.io/episodes/S01E53-test-driven-reactive-programming
To me, this is a subversive video... Lisa not only knows her stuff, but it's clear she enjoys sharing what she knows! She and Brandon (see above and below) were instrumental in helping me overcome the inital roadblocks.
Pragmatic Testing https://www.swiftbysundell.com/articles/pragmatic-unit-testing-in-swift/
Refactoring for Testability https://www.swiftbysundell.com/articles/refactoring-swift-code-for-testability/
John, like Chris and Paul, is constantly dabbling and sharing - and always enthusiastically! He makes periodic visits to conferences and I see updates from him on Reddit a few times a week. He (and a few others on this page) deserve a fuller write-up. It's on my to-do list.
The Two Sides of Writing Testable Code https://academy.realm.io/posts/try-swift-brandon-williams-writing-testable-code/
"I only write code if it can be tested. It’s a great boundary to force myself to write code in a functional style if it can be tested. And I’ve slowly started to think of my test code as the actual code that I care about, that the important work I do, not the implementation."
An Artsy Testing Tour https://academy.realm.io/posts/tryswift-ash-furrow-artsy-testing-tour/
- nothing is ever perfect.
- nothing is ever complete.
- sometimes we have to write code that’s not ideal and that’s ok
Please click on the issues button above and add any insights/comments/suggestions you may have.