---
title: "#130: Running Tests with Scan 🛠"
url: https://littlebitesofcocoa.com/130-running-tests-with-scan
author: Jake Marsh
date: 2015-11-20
published: 2015-11-20
topics: ["Fastlane","Testing","Libraries"]
description: "It's another fastlane friday here on LBOC. Today we'll be looking at another awesome tool in the fastlane suite called scan."
---

# #130: Running Tests with Scan 🛠

By Jake Marsh, November 20, 2015. HTML: https://littlebitesofcocoa.com/130-running-tests-with-scan

It's another [fastlane](https://littlebitesofcocoa.com/topics/56-fastlane?v=l) friday here on <i>LBOC</i>. Today we'll be looking at another awesome tool in the _fastlane_ suite called [scan](http://git.io/scan). It provides an easy way to run the tests of our **iOS** or **OS X** app. Let's dive in.

Before we begin, let's look at why a tool like [scan](http://git.io/scan) can be helpful.

**Xcode** ships with a great command line tool called [xcodebuild](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcodebuild.1.html) that allows to do all sorts of interesting things to our projects from the command line. It can be a bit verbose to configure though, and its output isn't very readable at a glance.

There's other tools like [xcpretty](https://github.com/supermarin/xcpretty) that can help improve this output, but they take a fair amount of configuration as well.

That's where [scan](http://git.io/scan) comes in. It takes care of all of this (plus a lot more) in one simple command: `scan`.

We'll start by installing [scan](http://git.io/scan):

``` shell
gem install scan
```

Then we run our tests at anytime like this:

``` shell
scan
```

This is all we need for basics usage. scan will auto-detect things like our **workspace**, but we can always configure things as well:

``` shell
scan --scheme "app-store"
```

Like other _fastlane_ tools, we can run scan init to generate a new `Scanfile`, where we can store all our configuration options:

``` ruby
scheme "Spaceships"
clean true
output_types "html"
```

## Other Features


📃 Displays nice output, stores original **xcodebuild** log in `~/Library/Logs/scan`

📄 Can generate **HTML**, **JSON** or **JUnit** reports

📣 Can send well-formatted test results to [Slack](https://slack.com/). Check out the `slack_only_on_failure` configuration option to only report failed tests.

[scan](http://git.io/scan) also helps with resolving common **Xcode** oddities like duplicated simulators or simulators that stop responding. Finally, [scan](http://git.io/scan) works great with tools continuous integration tools like [Jenkins](https://jenkins-ci.org/) and services like [Travis](https://travis-ci.org/). Happy testing!

 More info about _scan_ can be found at [git.io/scan](http://git.io/scan)
