Automatically run test on changed files when developing on XCode.
Ruby
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib/guard
spec
.gitignore
.travis.yml
Gemfile
LICENSE.txt
README.md
Rakefile
guard-xctool-test.gemspec

README.md

guard-xctool-test

guard-xctool-test allows you to automically & intelligently launch specs when files are modified.

Installation

Add this line to your application's Gemfile:

gem 'guard-xctool-test'

And then execute:

$ bundle

Or install it yourself as:

$ gem install guard-xctool-test

Dependency

Guardfile

guard 'xctool-test' do
  watch(%r{YourApp/(.+)\.(m|mm)$})
  watch(%r{YourAppTests/(.+)\.(m|mm)$})
end

How to Use

Make sure you installed xctool, and add appropriate .xctool-args to your project root before using guard-xctool-test. Alternatively you may specify appropriate :cli option.

Options

By default, xctool-test find the folder for projects and find a target that look like test. You can supply your target by using test_target option.

guard 'xctool-test', :test_target => 'YourAppTests' do
  watch(%r{YourApp/(.+)\.(m|mm)$})
  watch(%r{YourAppTests/(.+)\.(m|mm)$})
end

By default, xctool-test check all files under current folder for tests. You can specify a specific folder, or array of folders, as test path.

guard 'xctool-test', :test_paths => 'YourAppTests' do
  watch(%r{YourApp/(.+)\.(m|mm)$})
  watch(%r{YourAppTests/(.+)\.(m|mm)$})
end
guard 'xctool-test', :test_paths => ['YourAppUITests', 'YourAppTests'] do
  watch(%r{YourApp/(.+)\.(m|mm)$})
  watch(%r{YourAppTests/(.+)\.(m|mm)$})
end

You can pass any of the standard xctool CLI options using the :cli option:

guard 'xctool-test', :cli => '-workspace A.workspace' do
  watch(%r{YourApp/(.+)\.(m|mm)$})
  watch(%r{YourAppTests/(.+)\.(m|mm)$})
end

You might specify the full path to the xctool with :xctool option:

guard 'xctool-test', :xctool => '/usr/local/bin/xctool' do
  watch(%r{YourApp/(.+)\.(m|mm)$})
  watch(%r{YourAppTests/(.+)\.(m|mm)$})
end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request