mokacoding

unit and acceptance testing, automation, productivity

Archive



How XcodeGen reduced the TDD in Swift codebase by 58,000+ lines

A code generation story.

Tests Are The Best Kind Of Documentation

Unit tests are a vital tool for writing quality code. They also happen to be the best kind of documentation for your software, the kind that never gets out of date.

How to convince your team to adopt TDD

Test-Driven Development is an excellent way of writing code but many people push back against it. To convince your team to adopt it, lead by example. Don't preach. Let the quality of the code your wrote with TDD talk for itself and only suggest TDD when people ask about it.

The case for creating a merge commit

My current thoughts on which merge strategy to use on GitHub. "Create a merge commit" will help you make sense of how code changed over time without removing the option for a high-level overview of the changes on the main branch.

XCTNSPredicateExpectation is slow, and what to do about it

Each XCTNSPredicateExpectation requires a timeout of at least 1.1 seconds. That's will unnecessarily slow down your test suite. You can use Nimble's toEventually instead and make your tests as fast as possible.

When to test a @Published property using sink

Swift @Published properties come with an associated Combine Publisher that emits values over time. This free XCTest tutorial explains when to write a unit test that accesses the property directly and when it's instead necessary to subscribe to it using the sink operator.

A real-world example of TDD catching bugs

I published a YouTube video with a tutorial on implementing the FizzBuzz algorithm using Test-Driven Development. While recording, I made a couple of thinking or coding mistakes, and, sure enough, the tests immediately pointed them out.

How to write unit tests for SwiftUI apps

To test SwiftUI applications, don't test SwiftUI code. The SwiftUI framework doesn't lend itself to writing unit tests so don't try to shoehorn views in your test harness. Instead, split layout declaration form content generation logic.

Test-Driven Development in Swift is now available

My book, Test-Driven Development in Swift, is now available in online bookstores everywhere. You'll learn Test-Driven Development writing a real-world SwiftUI application, including events-flow management with Combine, networking, local storage, and third-party libraries.

WWDC21: What's New in Testing

A roundup of the testing-related new features announced at WWDC 2021. Including Xcode Cloud, how to test code using async/await, the new XCTExpectFailure and addTearDownBlock APIs, and the new Test Repetition configuration in Test Plans.

How to test Swift async/await code with XCTest

Swift 5.5 and Xcode 13 introduce the async/await pattern for concurrent code. This tutorial post shows how to write unit tests for asynchronous code in Swift using the XCTest framework.

How to write better tests for Swift date comparisons

Testing Swift date comparison code with XCTest can result in indeterministic tests because of the passage of time. To make tests robust and deterministic, decouple them from the system clock by injecting the reference date.

On the benefits of distributed work

Working from home doesn't have to be lonely. Going from remote to distributed can bring massive benefits to employees satisfaction and company productivity.

How to manage complex inputs in your Swift tests with Scenario Builders

When writing unit tests in Swift for complex objects, you may need to write a lot of setup boilerplate code in the arrange phase. Scenario Builders are a pattern that extracts and encapsulated all that logic in a single component with an English-like API. This tutorial shows how to build a Scenario Builder in Swift and looks at its pros and cons.

A World Without Slack

How to establish a workflow that minimizes unscheduled, unstructured communication and maximizes focus and productivity.

A distributed asynchronous release process

My latest post on mobile.blog explores two simple conventions Automattic uses to remove the need for synchronous meetings in their app release process.

Working Backwards

How working your way backwards from your desired outcome can make you more productive, focused, and motivated.

How waiting in line can improve your focus

Embrace boredom to train your brain to sustain focus when working on demanding tasks

Unit Testing Combine Publisher Cheatsheet

Snippets to test the behavior of Combine Publishers in XCTest ready to copy and paste into Xcode

Boring Iterations. Interesting Steps.

Camille Fournier encourages us to "Make Boring Plans" and move in small iterations.

How to migrate from SwiftUI to UIKit App Delegate Life Cycle in Xcode

This free tutorial shows how to migrate an existing app with SwiftUI life cycle to use UIKit App Delegate instead

How to stick with your New Year resolutions

The start of a new year is a great time to work on self-improvement, but unless you take the right steps, your New Year resolutions might not stick.

How to set default values in Swift compiler-generated initializers

You can get the Swift compiler to generate an initializer with default values for your structs, if you're willing to put up with a bit of mutability.

How to improve your Test-Driven Development workflow by asking "Do I need this yet?"

The "You Don't Need It Yet" technique to ship software on a schedule results in fast real-world feeback. The same mindset can be applied with Test-Driven Development to move between the Red, Green, and Refactor stages faster.

Write better Swift unit tests with custom XCTest assertions

The XCTest Swift testing framework has a limited offer of assertions. There's only so much you can do with XCTAssertTrue and XCTAssertEqual. This XCTest tutorial shows how to create custom assertions to make your unit tests and UI tests shorter and clearer.

How to write unit test assertions for Swift Result values

Result is one of the most useful types in the Swift language. Learn how to write better unit tests using Result in this XCTest tutorial.

When experiments go wrong

Scientist can learn a lot from failed experiments. To do so, they must be methodical and collect all sorts of information. Softwar developers can learn a lot from failures, too. What are the practicies that can make learning easier?

How to merge pull requests with a commit that improves your Git history

When merging a pull request on GitHub, it helps to replace the default merge commit title with the PR title or an equally descriptive one. This will make your Git history more informative, and developers will understand the changes in the Git log faster.

How to bypass the SwiftUI App when running unit tests

How to make the unit tests of your SwiftUI app safer and faster by preventing them from running the program startup flow. This will avoid all of the launch operations like network requests or reads from the local storage that would affect the global state.

How to rename a file in Vim

There are many ways to rename a file in Vim. Here's three.

How to remove trailing whitespaces from all files in a folder

Here's a shell command to trim all the trailing whitespaces in all the files of the current folder.

How to make the View to ViewModel relationship clear

Using Swift's nested types helps making it clear that a view model belongs to a view.

Dependency Injection in SwiftUI

This post shows two ways of achieving dependency injection in SwiftUI: using @EnvironmentObject or a View Model Factory.

What can a pipe wrench teach us about software engineering?

With his famous pipe wrench lecture, Vannevar Bush taught young MIT engineers the value of precision. The same teaching holds true for software developers.

Hyperfocus by Chris Bailey

Hyperfocus will teach you how to concentrate effectively and let your mind wander to reach creative insights.

You Don't Need It Yet

YDNIY is a purposeful restraint of what you decide to build in the interest of delivering value to the users as soon as possible and consistently.

"That's funny…" moments are learning opportunities

The most exciting phrase to hear in science, and software development, the one that heralds new discoveries, is not "Eureka!" but "That's funny…"

Will iOS 14 Destroy Your Productivity?

iOS 14 introduces Widgets, a feature that makes it incredibly easy to get distracted.

Replace Triple-state Boolean with Enumeration

Triple-state Booleans can be ambiguous to work with. Replace them with an enum to make the code clearer.

How to decouple unit tests from values that change frequently

When the output value of a function changes often but the logic to pick it doesn't, adding a separation layer will make unit tests easier to maintain.

How to add co-authors to a Git commit

How to check if macOS app is notarized

How to reverse a file in the terminal

How to verify your SSH private key password

How to check if array contains element with block in Ruby

Honesty-Oriented Programming

If you focus on writing honest code, you'll end up with software that is easier to understand and work with.

Referential Transparency in Swift

An explanation of what referential transparency means with examples in Swift

Should you change your branch name to "main"?

In Xcode 12, the default branch name is main instead of master. This little language change has deeper implications and stirred up an hornets' nest.

The Indistractable Developer

The quality of your focus time is directly proportional to your value in the market. Become Indistractable to maximize it.

How to use CocoaPods as a CLI tools manager

CocoaPods can be configured to only resolve and download dependencies, making it a great manager for vendored CLI tools

How to manually generate Devise reset password link

Midwives with the Apple Watch

How to use social media productively

Social media can be a valuable source of news and interactions, or a disruption to our focus. The difference is in how we approach using these technologies.

How to run a single test in Xcode

A collection of ways to run a single test or a subset of tests using Xcode.

How to test view controllers navigation

The answer to "How can I test that a view controller presents another view controller when something happens?" is as simple as defining a delegate.

Take care of your tools

"You take care of your tools, your tools take care of you."

Code Like A Chef

Professional chefs keep their benches clean because clutter will get in the way of their work. Software developers should do the same.

Top 10 Productivity Books

A running list of the top 10 most impactful books on productivity I've encountered so far

Why I'm cutting back on podcasts and audiobooks

I realized I was on a path to remove time for reflection from my life, mainly by filling every available moment with podcasts and audiobooks. These are the steps I'm taking to cultivate more solitude, and the benefits I'm already seeing.

Better tests for delegates

When testing delegates, we are asserting rigid implementation details. Here's a way to make those tests more flexible.

3 Lessons on Software Development from the New England Patriots

By looking at how the consistently successful New England Patriots operate we can learn useful lessons to apply to our job as software developers.

The value of decluttering and optimizing your software

Digital minimalists believe that clutter is costly and optimization is important. Let me show you how these ideas apply to software development as well.

Code Coverage Is A Broken Metric

But you should track it anyways.

Write Less Code

The best thing you can do as a software developer is not writing code, but removing it. Here's why.

How to TDD in Swift, a step by step guide

With test driven development you can write high quality software in small shippable steps. Here's how to get started.

The Productivity Project - by Chris Bailey

My notes and quotes from The Productivity Project by Chris Bailey

Test doubles in Swift: dummies, fakes, stubs, and spies.

An overview of the different kind of doubles we can use in our tests, and how to write them in Swift.

How to become drastically faster at using the terminal

Using the terminal might seem slow and cumbersome because every command needs to be typed. Learn how to drastically reduce the amount of typing you have to do by configuring aliases for your most used commands, making them only a few keystrokes long.

How to split decision and action logic with the Swift type system

There is a subtle way to overload software components, by making them both take decision and act on them. We can simplify these bloated components by separating the responsibility of taking decisions from the one action on them. This will result in leaner and easier to maintain software, and is made simple by the Swift type system.

How to remove duplication from Swift tests with helper functions

Some code ends up requiring a lot of duplication to be tested. You can remove it by using helper functions encapsulating the shared assertion logic.

Stephen King's Advice To Software Developers

In "On Writing" Stephen King shares invaluable lessons for aspiring novelists which can be applied to software development too.

Where to start to become more productive

What does it take to be productive? What does it event mean? Here's a introduction to the pillars of productivity, with many resources to start from.

How to write code faster using snippets

Leveraging "snippets" is a way to get faster at writing code and free mental resources for problem solving. Most IDEs and text editor offer this feature, where you can write code scaffolding with a keyboard shortcut.

Streamlining tests setup with fixtures in Swift

Keeping tests short and focused is important for the health of the test suite. A fixture method to generate instances with default values in the tests helps keeping the setup code short, focused, and readable

Invest in your terminal to become a better developer

One of the best things you could do to improve as a software developer is constantly investing in your terminal setup and skills.

What software developers can learn from Leonardo da Vinci

Leonardo da Vinci's life as told by Walter Isaacson in his biography is a source of inspiration for anyone working in a technical and creative field.

Red, green, and don't forget refactor

Test driven development works at its best when you refactor as you go. Write the failing test, write just enough code to make it pass, then and only then focus on making that code good.

Action focused protocols enhance testability

Using protocols describing a single capability or action that can be performed is a way to enhance local reasoning and facilitate testability

How to choose what to refactor

A way to identify the areas of code to refactor with the highest return of investment using the "focusing question" technique.

How to get better at setting priorities

The focusing question, a tool devised by Gray W. Keller, is a simple yet effective way to identify work to focus on with the highest return of investment.

If you're not writing tests first you're missing out

A look at the benefits of writing unit tests before production code, in other words TDD.

"Does Software Understand Complexity?" via Michael Feathers

Thoughts on a Michael Feathers post on how the understanding of complexity in software development compares to other fields.

Apps and Tools

A list of the apps and tools I use everyday and help me getting stuff done.

4 books to kick start 2018

Books suggestions to start 2018 with the right mindset and tools.

Symbolic links in Git

Here's how to track symbolic liks in a Git repository, in a way suitable for teams.

Quick beforeSuite and afterSuite behaviour

A look at how beforeSuite and afterSuite behave in the Quick testing framework, and the dangers of using them

Quick beforeEach and afterEach behaviour

A look at how nested beforeEach and afterEach behave in the Quick testing framework.

Nimble: when to use waitUntil or toEventually

The Nimble matchers framework provides two ways assert expectations on asynchronous code, this post explores when to use one or the other.

Unless.swift

Porting Ruby's unless operator into Swift via a function.

XCTest closure based expectations

Testing async code is not simple, but XCTest provides us with all the required tool. This post shows how to wait for an expectation to be fulfilled based on a Swift closure.

How to use dependency injection for classes in Swift

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.

Lessons learned working on danger-switlint selective linting

A little post to share some things I learnt while working on a PR for danger-swiftlint to allow selective linting.

Your Git Log Should Tell A Story

A look at the practical benefits of writing descriptive commits

Better Xcode Run Script Build Phases

Practical tips to write "Run Script" build phases in Xcode.

Setting Up Firebase Without Using CocoaPods

A guide on how to configure your Xcode project to use Google Firebase without using CocoaPods.

Implicitly vs Force Unwrapping Swift Optionals

A look at what implicitly unwrapping and force unwrap a Swift Optional mean, and how they differ from each other.

Cloud 66 Postfix Deploy Hook

A deploy hook to configure Postfix every time a Cloud 66 stack is built

Why Implicitly Unwrapping Swift Optionals Is Dangerous

A look at what implicitly unwrapping an Optional value means and why it should be avoided.

Swift Either enum

This post introduces the Either type and shows a practical application of it in Swift, injecting extra cells in a table view.

Strong Opinions Loosely Held

Strong opinions loosely held, and other cornerstones for a winning mindset

Writing your own Swift "if let"

An exercise to understand Swift's optional type: reimplementing the if let functionality

What is an optional value in Swift

This post looks into one of Swift's most powerful feature: optionals

Maintaining Sanity with Multiple Versions of Xcode

Working with Xcode and Xcode-beta on the same machine can sometimes be confusing, this post shares some tools to help make it less so.

How to make Swift methods unavailable

A quick post showing how to use the Swift availability attribute to mark objects and functions as unavailable.

Functional Core Reactive Shell

This is a blogpost version of the content of my talk "Functional Core, Reactive Shell"

Language Agnostic Automation Setup

Every project can benefit from having a set of scripts to automate tasks such as running tests or distributing to testers. When setting up automation for your projects you can use a language agnostic setup. This will make it easier for new team members to get started, and allow you to change the setup without having to change the way the scripts are invoked.

NSDateFormatter format for JSON dates

How to configure NSDateFormatter to work with JSON API dates.

"Functional Core, Reactive Shell" Resources

Links from my "Functional Core, Reactive Shell" talk

Getting Started With Automation

A collection of tips to get you started with workflow automation, increase productivity, and save time.

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

How to update all plug-ins for the latest version of Xcode and Xcode-beta

An handy script to update all Xcode plug-ins to be compatible with the latest version of Xcode and Xcode-beta.

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.

Ruby for iOS Developers - Managing Ruby Tools with Bundler

Between CocoaPods and Fastlane, Ruby is an important part of the iOS developer toolchain. How can we reliably control the versions of the tools our project's automation is using in Ruby? Bundler is a simple way to specify Ruby dependencies and automate their setup.

Ruby for iOS Developers - Managing Ruby Versions

Between CocoaPods and Fastlane, Ruby is an important part of the iOS developer toolchain. Managing versions and gems can be a challenge for developers outside of the Ruby community, but it doesn't have to be. In this two parts post we will see how to simply and reliably handle our Rubies.

How To Fix Fabric Crashing On Startup When Installed Via CocoaPods

If you are experiencing crashes with a version of Fabric and Crashlytics installed via CocoaPods chances are you are missing required information in the Info.plist. This post shows how to solve this issue.

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

How to prevent the unit test target from loading the AppDelegate and have faster tests execution.

How to use a double slash in xcconfig files

A short post showing how to use a double slash in xcconfig files, for example to write URLs like https://mokacoding.com

2015 Retrospective

A retrospective on my consulting business in 2015. What when well, what didn't and how to act on it, how to move forward in 2016. I think my personal experience could be valuable for every iOS freelancer, I have done a couple of things right that helped my business a lot.

Opening a PR to Bitbucket from the terminal

A simple script you can run to open a PR on BitBucket for your current branch.

How to update an Xcode plug-in for the latest version of Xcode

A simple command to run in your terminal to make sure you can use your favourite plugins on the latest version of Xcode

Hacker News Button

How to add an Hacker News button to your blog

Installing Xcode plugins from the terminal with Fastlane

How to install Xcode plugins from the terminal using Fastlane, and persist them across machines.

Injecting environment variables from a file with xargs

How to provide environment variables stored in a .env file as an input for a command execution without having to export then, with a deep look at the shell commands used.

How to configure Travis CI for iOS testing

A practical guide on how to configure Travis CI to run iOS, and OS X, tests.

How to use Homebrew in CI

A quick guide on how to safely use Homebrew in CI.

How to configure CircleCI for iOS testing

A practical guide on how to configure CircleCI for to run iOS, and OS X, tests.

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.

How To Sharpen Your Software Developer Tools

Practical advices on how to keep your tools sharp, master them, and become more productive.

Xcodebuild Destination Cheatsheet

A collection of tips on how to configure the -destination option for the xcodebuild tool.

The best free RSS reader app ever: IFTTT + Pocket

By using the powerful automation provided by IFTTT we can make deliver the latest posts of your favourite blogs to Pocket. This is the most powerful RSS reader ever, and it is free.

When to use map, flatMap, or for loops in Swift

Swift allows us to natively iterate over arrays using map. Map could be used to replace every for loop in your code, but that's not a great idea. Map and for have different purposes and should be used appropriately

How to display relative line numbers in NERDTree

Vim's relative line numbers are great for jumpin around files, and once you get used to them you want to enable them everywhere. Here's how to have NERDTree use relative line numbers

Automated Xcode version and build numbering via Git

How to configure Xcode to automatically set the version and build number of your projects using Git.

How to always use the latest Simulator with Xcodebuild

There is a simple keyword you can use in the destination option of an xcodebuild command to always run the most recent Simulator version.

Swift Optionals, Functional Programming, and You

This is the post version of a talk I've been given in the past months. In this post we will demystify functional programming terms like monad and functor, and see how those concepts can be brought back to the every day Swift development, in particular how they can help to deal with optionals in a leaner way.

An even lighter way to use Carthage

Among the options Carthage, an iOS and OS X dependency manager, provides there is the --no-build one. Using this we can integrate dependencies in the form of Xcode projects rather than frameworks, keeping the repository slimmer and the CI time low. This approach is lighter than than the usual way to work with Carthage, but comes with some disadvantages too.

How to install Xcode Command Line Tools without GUI or Xcode

Here's a little script that will allow you to install the Xcode Command Line Tools without having to install Xcode, nor having a logged GUI. This can come pretty handy in automated scripts or when provisioning virtual machines.

/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.

Enhancing XCTest test cases with Nimble matchers

Nimble is a matchers framework built for Swift that provides powerful and versatile expectations. Writing test within the standard XCTest harness but using Nimble assertions is easier and productive, and a good combination of tools to introduce testing and TDD to colleagues and teams in a frictionless way.

AFNetworking custom response serializer to add error information

How to implement a custom AFNetworking response serializer to read the failure response data and populate the callback error with it.

Explicit Dependencies, Swift Edition

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

How to have multiple iTunes Connect accounts, and submit apps

Swift array of characters from String

How to get an array of single characters String from a multiple characters String. From foobar to [f, o, o, b, a, r].

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.

How to reuse the last parameter in a terminal command

When typing a shell command it is possible to reuse the last argument of the previous call without having to type it. Let's see how.

Keep Your Bench Clean

Like good chefs keep their benches clean to make delicious dishes all day long in the restaurants' kitchens, so good developer keep their codebase clean. It all comes down to little habits, the result of which when summed up together is a tidy, clean and easy to maintain software.

Packaging an ipa with Swift files from the terminal

If you are having problems with xcodebuild failing to export your apps with either Swift or Watch Kit support here's the solution, with a handy custom script.

How to test UI changes in Xcode 7

One of the characteristic of the UI is that it changes, and there are scenarios in which writing UI tests to assure that the change has happened correctly can be very valuable for the reliability of our apps. Writing such a test is a bit harder than normal, let's see how to do it.

How to add testing dependencies using Carthage, with Swift 2 and Xcode 7

In this little tutorial we will see how to use Cathage, an OS X and iOS depencendy manager, to install libraries written in Swift 2 and Xcode 7, with a focus on the process to get testing dependencies.

Swift Functors, Applicatives, and Monads in Pictures

In this port to Swift of the great of Haskell's "Functors, Applicatives, And Monads In Pictures" we are going to look at these functional programming concepts aided by some very helpful pictures.

XVim, harnessing the king of text editor's power in Xcode

An introduction to the XVim plugin, that adds most Vim keybindings and features to the Xcode IDE, and how this can make you more productive as a developer.

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.

The value of acceptance testing for mobile projects

Companion blogpost for Gio's talk "Talking myself into the value of acceptance testing" at Melbourne CocoaHeads meetup

Xcode 7 UI testing, a first look

How to get started with UI testing in Xcode 7, recording tests and using the new APIs to assert the state of the application under test.

MailChimp automated workflow for mokacoding weekly

At mokacoding we're big on automation, and we eat our own dog's food! The workflow to write and send new issues of our newsletter, mokacoding weekly, is (partially) automated thanks to some simple Ruby scripting and Mac command line utilities.

Automation with pre-commit hooks

Git provides a mechanism to run one or more scripts before a commit is actually added to the history called pre-commit hook. We can use this hook to run scripts that validate or sanitise the changes to be committed automatically, saving time and brain power, and assuring the quality of the codbase and git log.

xUnique: a tool to avoid Xcode project merge conflicts

How many times when working on a Mac OSX or iOS app with a team have you had a merge conflict on the project.pbxproj file? I guess more than a few, a lot more than a few. Lucky for you there is an handy tool called xUnique that will make the chances of this happening way smaller.

Writing an Expecta custom matcher

Not only Expecta is a simple to use library that allows us to write highly readable code, but it can also be extended by the users with custom matchers. Let's see how to write a custom matcher to gain readability and reuse code in our test suites.

Expecta, a matcher library that speaks English

A test that express is intent clearly is arguably twice as effective as one that doesn't. Writing test in an xSpec style is a good first step to express behaviour clearly, and when matched with a matcher library such as Expecta the results are test that are easy to read and reason about

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

Job stories acceptance tests using KIF and Specta

When writing tests it's very important do be declarative, aiming to have tests that explain how a class is supposed to behave as good as its documentation would do. When talking about acceptance tests we can achieve this kind of clarity by having a 1:1 relationship between the tests and the acceptance criteria for the application. A very effective way to express acceptance criteria is through _job stories_. In this post we'll see how to write acceptance tests that map job stories for our iOS apps, using KIF and Specta.

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.

Setting up KIF for iOS acceptance testing

A guide on install and use the KIF framework for iOS acceptance testing.

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.

How to run Xcode tests from the terminal

How to invoke xcodebuild to run the tests from the command line and how to format its output using xcbeautify or xcpretty

How to simplify Calabash acceptance testing with Rake

Rake, the Ruby build utility, can lift off all the typing involved in running the Cucumber/Calabash acceptance tests, saving us a lot of typing time.

Git-iquette

Every team and every project should have a Git-iquette: a set of common practices for managing the git repository.

Setting up Calabash for iOS projects with Cocoapods and Build Configurations

A simple guide that shows the simplest way to install Calabash on an iOS project, by using Build Configurations and CocoaPods.

5 habits that will make you a better software developer

By implementing these 5 small habits you'll kickstart your 2015 and become a better software developer.

Security Tips for Freelance Software Developers

Tips for freelance software developers (and non) to improve the security of laptops, smartphones and website accounts, to keep your and your clients data safe.

Why I don't work on Fridays

Some time ago I learned the hard way that I shouldn't work on Fridays. I've been applying an alternative schedule to my week, and it's working out pretty well.

In-App Purchase Debugging Lessons

A couple of tips learnt the hard way on how to develop and debug In App Purchase support in an iOS app.

Why I (shouldn't have) stopped blogging with Jekyll

I recently decided to move my blog from Ruby and Jekyll, to Metalsmith and Javascript. It turned out to be not as easy as I thought, and a quite stupid choice, but not because of the tech.

CocoaPods and custom Build Configurations

Some tips on how to use CocoaPods and customs build configurations without headaches.

2014 resolutions review

Gradient Backgrounds Studio: Lessons Learned

A caveat when upgrading a Podfile

Sharing assets across iOS projects with CocoaPods, Resource Bundle, and dynamically loaded fonts

Automating iOS Enterprise Deployment with shenzhen

A way of automating the deployment of an iOS app for enterprise distribution using the shenzhen gem.

2013 retrospectives... and 2014 propositions

Taking a look back at 2013, to find good propositions for 2014

Podcasts, grow your brain through soundwaves

A list of the tech podcasts I follow

Rails: adding a new has_many association to an existing model

A little guide on how to edit an existing model adding a new has_many association

Some things I learned in October

A quick summary and memo of interesting things I've learned in October - iOS screen capture, HTML5 game development, ways to improve your coding.

A dive into Xcode projects and workspaces

A look at how Xcode stores information about the project and the workspace

October's Questions

Introducing mokagio's monthly questions, related to iOS, Objective-C, Xcode, xctool, AFNetworking, CocoaPods.

Some things I learned in September

A quick summary and memo of interesting things I've learned in September

Sharing some thoughts on iOS 7

Sharing thoughts by some lead designers on iOS 7.

Setting a Mac for Development

A simple checklist of the basic tools to setup a Mac for development.

Bringing font icons in iOS with MTFontIcon

Introducing MTFontIcon, a CocoaPod library for iOS to improve application development efficiency by using font icons.

A workaround to Xcode 5 GM crash on app submission

A workaround for the unusual crash of Xcode 5 GM during the App Store submission process.

Some things I learned in August

Some things I learned in July

A summary of the things I learned in July 2013.

What I did in a week...

A recap of what I developed during an unusual week left by myself without neither girlfriend nor friends.

A week of time...

A declaration of purposes for what I'm gonna do in the next week.

CocoaPods: the $(inherited) flag

A self memo on how to set the $(inherited) flag on a project using CocoaPods on Xcode.

Some things I learned in June

A summary of the things I learned in June 2013.

mokagio's self memo for Facebook Integration on iOS - Part 1

Step by step guide on how to integrate the Facebook SDK in an iOS app, the right way. Part 1: Facebook Login.

OSX, a scanner, and the drivers drama

The link to the Samsung Printer Drivers, enclosed in a ranting post.

Multiple builds of the same app and TestFlight

How to distribute multiple builds of your iOS app, such as stable, QA and development builds, via TestFlight.

CocoaPods - How to create your own Pod

A step by step guide to create a basic CocoaPod.

CocoaPods!

A brief introduction to CocoaPods, the Objective-C dependencies manager.