13 posts with this tag

Can Unit Testing and Core Data become BFFs?

April 02, 2018

Core Data and Unit Testing haven't always been the best of friends. Like two members of the same friend group who don't really know each other but really like their UIKit friend, Core Data and Unit Testing have in fact discovered that they have a lot in common and have gradually got more and more friendly with each other. But before we delve into how they can take it one step further and become firm friends, we need to understand what makes each of them tick. Getting to know each other Core…

Firefighting developers

April 21, 2017

Firefighters are portrayed, quite rightly, in our society as heroes. They courageous run into dangerous situations and save people. However, let's think about why we need firefighters. We need firefighters because our man-made environment has been built up over hundreds (or even thousands) of years, by many different hands with differing ideas on what's important. This legacy of inconsistent design, coupled with our differing attitudes to fire safety has meant that we need a professional fire se…

Making a request with a side of testing

September 27, 2016

Most iOS apps will have a networking component, in previous posts I've written about treating the network call and parsing as one task [https://williamboles.com/networking-with-nsoperation-as-your-wingman/] or how to cut down on unneeded network calls by coalescing [https://williamboles.com/removing-bolierplate-when-coalescing-nsoperations/] but in this article I want to describe a pattern I use to construct the actual requests. As we will see this pattern helps to encapsulate knowledge of reque…

Runnable test schemes for Travis CI

February 27, 2016

When I first created ConvenientFileManager [https://github.com/wibosco/ConvenientFileManager] I didn't add a unit testing target - what can I say, I was young(er) and foolish. Recently I decided to rectify this grievous error and added a unit testing target. After writing the tests I pushed them to my repo and CI took over. However, Travis CI [https://travis-ci.org/wibosco/ConvenientFileManager] ran into some trouble when attempting to run this test target, resulting in the following error: The…

Invest in Dumb view controllers for the sake of your unit tests

January 05, 2013

Cohesion is important for your application. Each unit of work should have a clear purpose and clear area of responsibility, this is known as the Single Responsibility Principle [https://en.wikipedia.org/wiki/Single_responsibility_principle] (SRP). If you find that you are working on a method/class that doesn’t have clear responsibilities, when you get the chance you need to refactor that method/class into smaller pieces - this will produce a code base that should be easier to understand (maintai…

Depend on nothing for your unit tests

December 17, 2012

Dependence injection (DI) is a useful technique to have in your unit testing toolbox. It's were we take implicit dependencies that our method/class rely on and make those dependencies explicit. It's especially useful when writing unit tests as it allows us to avoid using the black magic of method swizzling. A nice side effect of this is that you will create an application that is more decoupled, allowing you to have an easier time when refactoring. Dependency Injection Forms DI takes 3 main f…