mokacoding

unit and acceptance testing, automation, productivity

Posts tagged "testing"

Using Swift protocols to abstract third party dependencies and improve testability

Third party code can be hard to test, but you can use Swift's protocols to abstract its details and improve testability

ting

In Swift it is possible to pass a reference to a type itself, not just to an instance of it. This post shows how to use this capability to test legacy code.

Getting Started With OHHTTPStubs

Good unit tests are fast and deterministic. Testing code that hits the network could undermine this goal, but using OHHTTPStubs we can take back control of our tests. This post explores the advantages of stubbing the network, and provide a guide on how to do it with OHHTTPStubs.

Why hitting the network is bad for your test, and what to do about it

In this post we are going to look at why hitting the network from your unit tests is a bad thing, and introduce some way to solve the problem.

Async Testing with Quick and Nimble

A look at how to write tests for async code when using the Quick and Nimble Swift frameworks. This post is part of the Practical Testing in Swift series.

Testing Delegates in Swift with XCTest

In this second post of the Practical Testing in Swift we a look at strategies to test how objects call their delegate methods or set property on them.

Testing callbacks in Swift with XCTest

Prevent Unit Tests from Loading AppDelegate in Swift

Short post showing how to prevent the unit test target to load the AppDelegate and have faster tests execution.

Fixing Bugs Driven By Tests in Swift

Unit and acceptance test are powerful tools that can be used to identify and fix bugs. Let's see how using a bugged Swift app as an example.

/dev/world/2015 notes of a testing fanboy

I attended /dev/world/2015 in Melbourne this week. It has been a great conference, full of very friendly and smart people. Being a test and automation fanboy I attended as many talks related to that topic as I could. These are my notes.

Explicit Dependencies, Swift Edition

A look at how to write classes and structs that expose their dependencies as initialization arguments in Swift.

Explicit Dependencies for Code with No Surprises

Sometimes the idea we get when reading a class interface is different from what is actually going on inside its implementation, for example there could be several hidden dependencies. Making a class dependency explicit in its interface is a useful technique to make the code simpler to understand, and easier to test.

Testing Realm apps

Realm is a mobile database that, unlike CoreData, is easy to test. In this post we will discuss some ideas on how to test an app using Realm as its database.

Specta global before and after each hooks (Updated)

An interesting and powerful, yet not at all documented feature of Spetca are global beforeEach and afterEach hooks. In this post we'll see how to configure them, and how to blacklist classes from running them. Updated for version 0.5

Better tests with Specta

Writing unit tests for our iOS and OS X projects not only is important, but should be always part of the development cycle. As such the way we write the tests is as important, and having the option to write tests that easily explain their purpose can drastically increase the quality of the suite. Specta and Expecta are two libraries that provide a different way to writing tests than XCTest, let's see what we can gain by using such approach.

Xcode keyboard shortcuts for testing

Keyboard shortcuts are easies way to start increasing your productivity. Let's look at how to run tests in Xcode without ever touching the mouse.

The state of iOS testing in 2015

In this post we'll look at the main tools and libraries available to write unit and acceptance tests for iOS and OS X applications, as well as the solutions to host Continuous Integration for our projects.

Specta global before and after each hooks

An interesting and powerful, yet not at all documented feature of Spetca are global beforeEach and afterEach hooks. In this post we'll see how to configure them, and how to blacklist classes from running them.

Running Xcode tests from the terminal

In this post we take a look at how to run Xcode tests suites from the terminal with xcodbuild and xcpretty, and why you should do it