Swift TDD with Jon Reid
Today on iPhreaks Show, Andrew and Guillherme discuss Swift TDD with Jon Reid. Jon is the author of Quality Coding blog, and has been doing test-driven development for some time. He appeared as guest in episode 116, where he talked about TDD and testing. Tune in for more classic insights about it and about why you should not take Apple sample code literally!
What is TDD
It basically means test-driven development, which involves going around in 3 steps. Jon calls it as waltz.
In TDD, you start writing the production code with the expectation that it will fail. Afterwards, you perform what the test requires. You then check both production and test code to see if anything needs to be changed, and do it over again.
Approach to Unit Tests
As the years progressed, people appears to have become more friendly. They acknowledge the importance of writing the unit test. But, often it's more difficult.
Consider for example that you have a massive glob of code that is doing too much. You may not have to do unit test for it. Breaking it apart first might do well.
Writing Testable Code
Remember that the normal way to start a test is by knowing it will fail. To fix it, you would need to write code. Doing so naturally leads self to writing testable code.
Among the struggles is determining how to break it into testable pieces than as a glob. The good thing about it, however, is you get better APIs just by doing it.
Download and listen to Swift TDD with Jon Reid. What are your thoughts about this episode? Leave us a rating and review if you enjoyed the show. We would love to hear from you!
Guillherme Rambo: Is It Snappy iOs app
Jon: AppCode as IDE, Refactoring by Martin Fowler
Andrew: Graphic Converter