This week, let’s take a look at various ways that we can assert that our code produces the right outcomes within our unit tests, including how we can create our own assertion functions.
This week, let’s take a look at a few different ways to deploy unit testing in a more pragmatic manner — to use testing to solve immediate problems, and to enable our code to be tested without having to fundamentally change it.
Casey Liss joins John to talk about Apple’s newly announced Combine framework for reactive programming, how it compares to existing tools like RxSwift, and different strategies for adopting it. Also, unit testing, life as an indie developer, and much more.
While a big part of writing testable code comes down to how our dependencies are managed, how we structure and manage our testing data is often equally important. This week, let’s take a look at a few different techniques that can enable us to define such data more easily — and how that can have a big impact on how much effort that’s required to both read and manage our tests.
When writing any kind of automated tests, it can sometimes be tricky to achieve a balance between making tests run efficiently and predictably, while still exercising the right code paths under realistic conditions. This week, let’s take a look at one way to achieve such a balance, by verifying the integration between multiple code units.
When writing automated tests, many of us have a tendency to focus on verifying that our code behaves correctly under ideal conditions, but we should really also test how our code behaves when something goes wrong. This week, let’s take a look at how unit tests can be used to verify the correctness of our code’s various failure states.
Using unit tests, and other forms of automated testing, can be a great way to protect a code base against regressions and reduce the need for manual testing. Let’s take a look at how to get started.
When getting started with unit testing, it usually doesn't take long to realize that some form of mocking is needed. Although mocking will most likely remain essential for many types of testing, this week, let's take a look at a few different ways to write mock-free unit tests in Swift.
Ellen Shapiro joins John to talk about all sorts of automated testing — unit tests, integration tests, UI test, you name it! The two also discuss Ellen's recent adventures into Kotlin and whether Kotlin Native could become a nice cross-platform solution for mobile apps.
Asynchronous code is essential to providing a good user experience, but can at times be really tricky to write, debug and especially test. This week, let's explore how we can make our asynchronous tests much simpler, inspired by the async/await programming paradigm.
Being able to use unit testing in a productive way often requires the various parts of an app to be written with testability in mind, which isn't always the case. This week, let's take a look at a few different refactoring techniques that can help us make non-testable code much easier to test.
When writing tests for any application, it's always important to consider what the debugging experience will be like when they eventually start failing. This week, let's take a look at a few different scenarios, and how we - with just a few subtle tweaks - can make our tests a lot easier to debug.
Xcode 10 includes two new features aimed at addressing two common testing problems - flakiness and slowness. In this year's last daily WWDC update, let's take a look at what those features are and how they can potentially make our tests faster and more robust.
When starting to work with tests, there's one problem in particular that almost every developer runs into - how to test asynchronous code. While we've touched on this subject before, this week, let's focus in on a few different techniques that can help make testing asynchronous code a lot easier.
Mocking is a key technique when it comes to writing unit tests in pretty much any language. Whether we're testing networking code, code relying on hardware sensors like the accelerometer, or code using system APIs like location services - mocking can enable us to write tests a lot easier, and run them faster in a more predictable way.
Managing memory and avoiding leaks is a crucial part of building any kind of program. This week, let's take a look at how we can set up unit tests to both help us identify memory leaks, and also make it easier to avoid common mistakes that could end up causing leaks in the future.
While force unwrapping is an important feature, it also circumvents parts of what makes Swift so great. However, dealing with optionals and unknown types in a safe way can require quite a lot of code, so the question is whether we want to do all of that additional work when writing tests as well?
Soroush Khanlou joins John to talk about blogging, MVVM and other iOS architecture patterns, unit testing, new features in iOS 11 & Xcode 9 and much more.
Ash Furrow from Artsy joins John to answer questions about being inspired by other languages, asynchronous programming, doing test-driven development and much more.
Flakiness is what happens when tests don't run consistently, when different circumstances produce different results. This week, let's take a look at some easy-to-apply tips and tricks that can help reduce flakiness, and make our tests more predictable within any environment.
Almost all modern apps use JSON in one way or another. Whether it's for configurations, to store local data or to download information over the network - JSON is everywhere. This week, let's take a look at how we can set up our JSON mapping tests to make them a lot more robust and future proof, and how we can use them to perform end-to-end testing.
Swift playgrounds are awesome for things like trying out new frameworks and exploring new language features. The instant feedback they give us can really provide a huge productivity boost and enable us to try out new ideas and solutions quickly. This week, let’s take a look at how Swift playgrounds can also be used for writing unit tests.
A lot of code that we write relies on the current date in some way. Let's take a look at how to test such code in a fast and predictable way, without having to invent a lot of infrastructure or resort to hacky solutions like swizzling the system date.
In this talk I spoke about unit testing in Swift, and gave several tips on how code can be refactored to become much more testable.
Most apps written for any of Apple’s platforms rely on APIs that are singleton-based. From UIScreen to UIApplication to NSDate, static APIs are everywhere in Foundation, UIKit and AppKit. In this article I'll go through 3 steps to easily test code that uses such APIs.