Testing the UI without UI Testing in Swift Testing the user interface is an essential part of software development. Unfortunately, UI testing frameworks such as Apple's XCUITest are often unreliable and slow. However, there are other methods of testing the user interface, and in this post, Joe Masilotti shows us how to write UI tests using XCTest, Apple's unit testing framework. Posted on December 6, 2020 #testing
Unit Testing Asynchronous Code in Swift Implementing unit tests for asynchronous logic presents challenges such as false-positive test results and untrustworthy or error-prone test executions. In this post, Vadim Bulavin describes four patterns that help us to deal with such challenges, enabling us to reliably test asynchronous code. Posted on November 16, 2020 #testing #asynchronous
Testing delegates and protocols in XCTest The delegate pattern uses composition to provide similar advantages to object inheritance and is a pattern commonly used when developing for Apple's platforms. In this short post, Sarun Wongpatcharapakorn demonstrates his technique for testing code which uses delegation. Posted on September 17, 2020 #testing #xctest
Unit testing retain cycles Paul Samuels demonstrates how we can use two helper functions to easily unit test for retain cycles. Posted on November 27, 2018 #testing #retain
Async/await in Swift unit tests John Sundell shows us how to use the async/await programming paradigm to write concise unit tests for asynchronous code. Posted on September 25, 2018 #asynchronous #testing
Refactoring Swift code for testability John Sundell describes pure functions and dependency injection - two techniques we can apply when refactoring Swift code to make it more testable. Posted on July 22, 2018 #refactoring #testing
Swift Evolution - RFC: In-Line Tests In this RFC, Robert Widmann suggests a very interesting Swift evolution idea. Robert comments that currently, unit testing in Swift feels like a second-class citizen, and comes with significant overhead. To improve the situation, he suggests the idea of in-line tests, enabling us to add unit tests right next to the code being tested. I really like this idea. 👍🏽. Posted on April 28, 2018 #testing
The Cake Pattern with Swinject Peter-John Welcome demonstrates how we can use the Swinject framework together with the cake pattern to implement dependency injection. The major benefit is decoupling of components, which in turn means easier unit testing. Posted on April 24, 2018 #injection #testing
Unit testing asynchronous Swift code John Sundell demonstrates a few techniques that can help us test asynchronous code. He first looks as expectations and dispatch queues, and then shows us how we can make our asynchronous code synchronous for the purposes of testing. Posted on March 3, 2018 #testing #asynchronous
Using unit tests to identify & avoid memory leaks in Swift John Sundell demonstrates how we can use simple unit tests to identify and avoid memory leaks. John looks at three scenarios - using delegates, observers, and closures - and describes the problem that can arise with each. Posted on November 28, 2017 #memory #testing #leak