Members: Get 50% off Codeship for 12 months

Our members save between $294 and $2,994 on their first year of continuous integration and deployment with Codeship. Become a member today for just $20 and get access to this and many more member benefits.

Node mock in-memory file system for testing #

In Node, the fs module provides file system access. Tim Schaub’s mock-fs module allows Node’s built-in fs module to be temporarily backed by an in-memory file system during testing.

From Tim’s post Mocking the file system:

When writing tests, it’s common to run up against code that relies on file system access. People often end up including a bunch of test fixtures along with their code. Tests might create some temporary space, copy fixtures in place, run code, make assertions about what was read or written, and then clean up. The result can be fragile when working across multiple operating systems and leads to long test run times. In cases like this, a mock file system provides an alternative.

Checkout the source on GitHub.

Catch UI regressions with Huxley from Facebook

Pete Hunt and Maykel Loomans (from Instagram) launched Huxley a little while back. It’s a test-like system for catching visual UI regressions in web applications — similar to a test suite for code, but instead it takes screenshots as you browse and compares them to a known good version of your site.

Spring: pre-load your Rails apps #

When you’re working on a big app, Rails’ startup time can be slow. It’s a hard problem, and there’s been a lot of work done in Ruby and Rails to help solve this pain.

Rails Core member Jon Leighton has a new gem that helps solve this problem: it’s called spring. Basically, Spring is in the same ‘genre’ of gems as Spork and Zeus: it loads your app up and keeps it running in the background, so the next time you run your tests, things are fast.

Using spring is easy:

$  cat >> Gemfile
gem "spring"
$ bundle
$ spring testunit

This boots up your app, runs the tests, and keeps the app running in the background. You can see that your app is running with spring status:

$ spring status
Spring is running:

26150 spring server | rails-3-2 | started 3 secs ago
26155 spring app    | rails-3-2 | started 3 secs ago | test mode 

Now, adding spring before every command is a lot of effort, so similar to bundle, spring can generate binstubs that take care of this for you:

$ spring binstub testunit
$ bin/testunit


If you haven’t used Spring before, check out the README. If you were using earlier versions of Spring, Jon just released 0.8, so check out the CHANGELOG for details on what’s new.

Bwoken – iOS UIAutomation testing in CoffeeScript #

Testing iOS apps is hard. Apple’s UI Automation lets you write test scripts in JavaScript and simulate user interaction, but who wants to hang out in the Instruments GUI app? Bendyworks has improved on the process, however, bringing the simplicity of Rake and the elegance of CoffeeScript to your UI Automation tests:

#import "../../../../Pods/tuneup_js/tuneup.js"

#import "helpers/TravisCI.js"

test 'Favoriting a repository', (target, app) ->
  RepositoriesScreen.tapRepositoryNamed 'CITravis by Travis-ci'
  FavoritesScreen.assertFavoriteNamed 'CITravis by Travis-ci'

test 'Unfavoriting a repository', (target, app) ->
  FavoritesScreen.assertFavoriteNamed 'CITravis by Travis-ci'
  FavoritesScreen.tapFavoriteNamed 'CITravis by Travis-ci'
  FavoritesScreen.assertNoFavoriteNamed 'CITravis by Travis-ci'

This single test can be run from the command line with:

$ RUN=iphone/favorites rake

Check out the project website, source on GitHub, or introductory video for more. Also be sure to check out their, a mobile client for Travis CI, for a real-world example.

JSCheck – random property testing tool for JavaScript #

Douglas Crockford has released JSCheck, a lightweight JavaScript testing tool. Inspired by the Haskell library QuickCheck, JSCheck will generate random test cases against the specified properties of a system, function, or object. The project introduces a JSC global which includes:

The claim function takes a name, a predicate function, and an array of specifiers.

The predicate function should return true if a case passes. It will take a list of arguments that is generated by the array of specifiers. The array of specifiers looks like a type declaration for the predicate function.

It returns a function that can be processed by JSC.check.

To test the following function:

function le(a, b) {
    return a <= b;

one might construct a test as follows:

JSC.test("Less than", function (a, b) {
    return le(a, b);
}, [
], function (a, b) {
    if (a < b) {
        return 'lt';
    } else if (a === b) {
        return 'eq';
    } else {
        return 'gt';

The calls to JSC.integer will return an integer between 1 and the supplied argument. The JSC object provides a lengthy list of these specifier functions, including the ability to compose complex array templates:

    JSC.string(8, JSC.character('A', 'Z'))

… which will yield something similar to


Check out the source on GitHub and the included HTML docs, or you can view them in the GitHub pages branch of my fork view them on

Fivemat – better test output formatting for Ruby #

Tim Pope is a first-balloter for any future Vim Hall of Fame so we’ll forgive him the pun on his latest project. Fivemat (which is better than format) aims for middle ground between nothing bot dots and a firehose of test output. With support for MiniTest, RSpec, and Cucumber, Fivemat provides dot summaries and failure output per file.

features/sign_in.feature ......F--........
  no button with value or id or text 'Go' found (Capybara::ElementNotFound)
  ./features/step_definitions/web_steps.rb:53:in `/^I press "([^"]*)"$/'
  ./features/sign_in.feature:10:in `When I press "Log In"'
features/sign_out.feature .......
features/sign_up.feature ...............................................

Check the README on GitHub for configuration for your favorite Ruby testing framework. Also, if you’re new to this blog, be sure and listen to Episode 0.5.6, a classic in which Tim, Drew Neil, and Yehuda Katz school us on Vim.

#75: Travis CI, Riak, and more with Josh Kalderimis and Mathias Meyer

Wynn caught up with Josh Kalderimis and Mathias Meyer from Travis CI to talk about hosted CI in the sky, scaling apps, and a little Riak. Items mentioned in the show: Travis CI a hosted continuous integration service for the open source community. Josh Kalderimis is a core Travis CI team member, Rails contributor, gem […]

Travis CI now supports Python and Perl #

Since we first covered Travis CI a year ago, the project has continued to improve support for Ruby as well as additional languages. In addition to supporting PHP as well as Java, Scala, and Groovy, Travis now supports Perl and Python.

Setting up your Python project is straightforward. Just provide the travis.yml to declare your supported Python versions, install, and test scripts:

language: python
  - 2.6
  - 2.7
  - 3.2
install: pip install -r requirements.txt --use-mirrors
script:  python test

We’re excited to have Josh and Mathias from the Travis team on the next episode. Stay tuned.

CSS3 Test – How does your browser score for its CSS3 support? #

If you’d like to know how your browser scores for its CSS3 support, you have to check out Lea Verou’s CSS3 Test. She announced the project yesterday on her blog.

Here’s screenshot of my browser, Google Chrome 23.0.1271.101.

The CSS3 Test

Lea actually planned this as an improvement to her interactive CSS playground called Dabblet (Source on GitHub), but it didn’t work out the way she planned, so she released CSS3 Test on its own.

If you haven’t yet, read her blog post about the project – she talks about how it works, using browserscope, how it doesn’t work on dinosaur browsers like IE8, and why she built it in the first place.

A word of caution the CSS3 test checks which CSS3 features your browser recognizes, not whether or not they are actually implemented correctly. Oh, and WebKit claims to support CSS3 background-repeat, but it is LYING.

If you’d like to add tests to CSS3 test, go to tests.js and follow the current structure. Also, there are lots of great conversations and comments about the project on Hacker News.


Spinach – Like Cucumber but with more Ruby, less Regex #

Another week, another Ruby testing library. The latest is Spinach from the developers at Codegram which aims to remove the Regex magic from Cucumber. In Spinach, steps are implemented as Ruby classes:

# from the docs at [](
class TestHowSpinachWorks < Spinach::FeatureSteps
  Given 'I have an empty array' do
    @array =

  And 'I append my first name and my last name to it' do
    @array += ["John", "Doe"]

  When 'I pass it to my super-duper method' do
    @output = capture_output do



At first glance, Cucumber users will wonder how those steps could match multiple features. That’s the whole point. Spinach features are Ruby classes. Each feature has its own steps, and Spinach steps are just Ruby methods. The intent is to remove the magic of Cucumber’s Regex-based steps and to make sharing explicit via mixins. This means you can even bundle your steps and share across projects via Ruby gems.

Spinach comes with a generator that will scaffold the steps in your class based on your feature, turning a feature such as:

## features/test_how_spinach_works.feature
Feature: Test how spinach works
  In order to know what the heck is spinach
  As a developer
  I want it to behave in an expected way

  Scenario: Formal greeting
    Given I have an empty array
    And I append my first name and my last name to it
    When I pass it to my super-duper method
    Then the output should contain a formal greeting

… into

## features/steps/test_how_spinach_works.rb

class TestHowSpinachWorks < Spinach::FeatureSteps
  Given 'I have an empty array' do

  And 'I append my first name and my last name to it' do

  When 'I pass it to my super-duper method' do

  Then 'the output should contain a formal greeting' do


Check out the website, docs, or introductory blog post for more. I’d be interested to see how Spinach compares to Cucumber in terms of test suite speed.

Ghostbuster: Easier headless testing with PhantomJS (and CoffeeScript) #

Ghostbuster from Joshua Hull from the Padrino team aims to make it even easier to get started with PhantomJS. Just by installing the gem, Ghostbuster will download and configure Phantom JS so you can write beautiful tests in CoffeeScript.

phantom.test.root = "" # you must specify your root.

phantom.test.add "Simple index", ->         # this adds a test
  @get '/', ->                              # this will get your a path relative to your root
    @body.assertFirst 'p', (p) ->           # this asserts the first paragraph's inner text
      p.innerHTML == 'This is my paragraph' # is 'This is my paragraph'
    @body.assertAll 'ul li', (li, idx) ->
      li.innerHTML == "List item #{idx + 1}"
    @succeed()                              # all tests must succeed

I love the simple test output. UTF-8 entities FTW:

For /Users/joshbuddy/Development/ghostbuster/ghost/
  ✓ Simple index
  ✓ Form input
  ✓ Link traversal
  ✗ Bad link traversal
    Assert location failed: Excepted, got
  ✗ Form input not equal
    Assert first for selector #out did not meet expectations

For /Users/joshbuddy/Development/ghostbuster/ghost/
  ✓ Simple form
  • Form should do more things

See the GitHub repo for usage.

Goldberg: Lightweight, multi-language continuous integration server #

We’ve covered continuous integration projects such as
before. Now Goldberg, which has just turned 1.0, jumps into the
ring with a

Goldberg supports RVM and Bundler for Ruby projects, but it
can build most any software project, simply configure the command in
the project configuration. Goldberg also supports a number of callbacks
and notifications, to perform work when builds are complete, even when
projects go green.

Project.configure do |config|

  # project configuration
  config.frequency = 20
  config.ruby = '1.9.2' # Your server needs to have rvm installed for this setting to be considered
  config.environment_variables = {"FOO" => "bar"}
  config.after_build { |build, project| `touch ~/Desktop/actually_built`}
  config.timeout = 10.minutes
  config.command = 'make' #to be used if you're using anything other than rake

  # callbacks and notifications

  # sending mail
  config.on_build_completion do |build,notification,previous_build_status|
    notification.from('').to('').with_subject("build for #{} #{build.status}").send

  # code to deploy on staging
  config.on_build_success do |build,notification|


  # post to IRC channel & send mail
  config.on_build_failure do |build,notification|


  # post to IRC channel & deploy on staging
  config.on_red_to_green do |build,notification|



For advanced usage and information on how to contribute, be sure and
check out the README.

[Source on GitHub] [Discuss]

Summer Breeze: creates dynamic Rails fixtures for Jasmine tests #

On stage at Red Dirt Ruby Conference, Noel Rappin has released Summer Breeze, a gem that makes working with Jasmine in Rails a bit easier. Summer Breeze dynamically creates Rails fixtures for your Jasmine tests.

Installation and usage

To install via RubyGems:

gem install summer_breeze

… and run the bundled generator:

rails generate summer_breeze:install

Now you can define you fixtures in the generated initializer:

fixture "PostsController##index.body_container"

You then have several options for telling Jasmine about your new

sb.findSelector(fixture_name, selector)

A sample test might look like:

it("hides text when asked", function() {
  $form_container = sb.findSelector('login', '.form_container');
  $hide_link = $form_container.find(".toggle_link");

Be sure and check the
Readme for advanced
usage and limitations.

[Source on GitHub]

travis: Distributed CI for the Ruby community using Rails, Websockets, and Redis #

Berlin based Rubyist Sven Fuchs asks if Java-based Jenkins is the best CI tool for open source Ruby projects.

Sven writes:

Instead, imagine a simple and slim build server tool that is maintained by the Ruby community itself (just like Gemcutter is, or many other infrastructure/tool-level projects are) in order to support all the open-source Ruby projects/gems we’re using every day.

Instead of just imagining, Sven and others have been working toward that vision with Travis, an extremely alpha Rails project. Travis is a single-page application built in Rails and uses Backbone.js as a client-side MVC frontend.

How it works

By configuring a post-receive URL in your GitHub project settings, GitHub will ping Travis when new git commits are received. Travis will then schedule a build in Resque, a Redis queue. Travis then uses Websockets courtesy of PusherApp to update registered browsers on build status as it runs in the background.

travis architecture

Take a look at some of the projects getting built over at, the project’s new home page or checkout Sven’s quick tour of Travis in this screencast:


Currently, the hosted edition of Travis is open to anyone with a GitHub account. Just sign in with GitHub. Once you’re in, grab your Travis build token and configure a post-receive URL in your GitHub project’s Service Hooks page:


Host Travis yourself

If you want to run your own instance, you’ll need to set up configuration settings:

$ cp config/travis.example.yml config/travis.yml

If you want to run on Heroku, you’ll need to set some ENV variables

$ rake heroku:config

IF you’re running locally, you can start a worker with

$ RAILS_ENV=production VERBOSE=true QUEUE=builds rake resque:work

… or if you’re using God:

$ cp config/resque.god.example config/resque.god
  $ god -c config/resque.god

How you can help

Travis is in EARLY ALPHA. Sven and gang are looking for folks to help test, log issues, and submit patches. If you want to join the community, join the Google Group or hang out in #travis on IRC.

Special thanks

Sven and team would like to offer a special thanks to Pusher App for donating a Big Boy account for the project. If you’d like to pitch in with the compute side of the project, (we’re looking at you Heroku or Linode), please ping Sven.

[Source on GitHub] [Blog post] [Discuss on HN]

#48: Jenkins (formerly Hudson) with Kohsuke Kawaguchi and Andrew Bayer

Kenneth and Wynn caught up with Kohsuke Kawaguchi and Andrew Bayer from the Jenkins project to talk about continuous integration, Java, and corporate backing drama. Items mentioned in the show: StickerMule is making some awesome stickers for us Wynn and Adam received their Hubcap stickers as well CI Joe is GitHub’s continuous integration server Knowing […]

tobi: Expressive server-side functional testing with jQuery #

Ruby devs have long profited from powerful testing tools such as Cucumber, Webrat, and Capybara for functional testing.

Now TJ and LearnBoost bring the approach to server-side JavaScript apps with Tobi. Stitching together jsdom, htmlparser, and jQuery, Tobi lets you step through the DOM, follow links, fill in & submit forms, and assert results.

To use, configure Tobi in your test:

var tobi = require('tobi')
  , app = require('./my/app')
  , browser = tobi.createBrowser(app);

The browser object provides the entry point to Tobi. Let’s start by performing a GET to our application:

browser.get('/', function(res, $){


The first argument is the path, in this case the application root. We also supply a callback function that accepts two arguments – the response and the jQuery $ function which allows us to traverse the DOM. We can assert on both:

browser.get('/', function(res, $){
  $('h1').should.have.text("Howdy y'all");

As we mentioned, Tobi can also fill in forms

      'user[name]': 'tj'
    , 'user[email]': ''
    , 'user[agreement]': true
    , 'user[digest]': 'Daily'
    , 'user[favorite-colors]': ['red', 'Green']


… and follow links

$('a.register', function(res, $){


Tobi extends TJ’s should.js project to provide a large number of assertions for testing everything from DOM text and attribute to header fields and status codes.

[Source on GitHub]

Watch Wednesday

Quick hitting list of projects to check out on GitHub: pauldowman / gitmodel Git Model is an ActiveModel-compatible NoSQL store based on git. Not ready for primetime but very interesting. assaf / vanity Vanity is declarative A/B testing for Rails. sidelab / tile5 Tile5 is a nifty multi-provider mobile-optimized mapping framework for building mapping or […]

soda: Selenium adapter for Node.js #

Soda the latest project from LearnBoost, brings Selenium RC to Node.js.

Install Soda via npm

$ npm install soda

and with your Selenium server running you can run an example in your Node app with:

$ node examples/my_example.js

As with most everything Node, example actions are callback-driven:

browser.session(function(err){'/', function(err, body, res){
    browser.type('q', 'Hello World', function(err, body, res){


To keep your code from looking like a set of Matryoshka dolls, Soda supports chaining:

  .type('q', 'Hello World')
    if (err) throw err;

Testing in the cloud

With Saucelabs, you can even move your acceptance testing to the cloud:

var soda = require('soda')
  , assert = require('assert');

var browser = soda.createSauceClient({
    'url': ''
  , 'username': '<your username>'
  , 'access-key': '<your api key>'
  , 'os': 'Linux'
  , 'browser': 'firefox'
  , 'browser-version': '3.'
  , 'max-duration': 300 // 5 minutes

Keep an eye on the README and API docs for more advanced examples.

[Source on GitHub]

htty: HTTP TTY, curl meets lynx in an HTTP console #

We’ve covered a number of web console tools like Webshell, a nifty HTTP console for Node.js, and Twurl, the Twitter-specific tool for Ruby.

But when Nils Jonsson created an incredibly useful HTTP console with some old-school flair, we took notice. HTTY brings HTTP to a handy terminal shell in what Nils describes as a combination of curl and lynx.

HTTY is installed as a gem:

sudo gem install htty

You can then fire up the console with your API or web site endpoint:

$ htty
*** Welcome to  htty , the HTTP TTY. Heck To The Yeah!>

To make a request, just use the get command

*** Type cookies-u[se] to use cookies offered in the response
 200  OK -- 10 headers* -- 27206-character body>

To see what we got back from the server, just use body:

$ body
[{"repository":{"description":"(Mac OS) TVShows 2 "Phoenix" is the next iteration of the easiest way to download your favorite TV shows automatically.","has_issues":false,"homepage":"","fork":false,"has_downloads":true,"watchers":78,"pushed_at":"2010/08/16 14:39:36 -0700","url":"","private":false,"name":"TVShows","owner":"mattprice","forks":10,"has_wiki":false,"created_at":"2009/09/15 17:44:46 -0700","open_issues":7},"created_at":"2010/09/05 21:04:43 -0700","sha":null,"public":true,"actor":"pengwynn"

HTTY is incredibly well documented, and the help command lists the full power of the console:

$ help


  a[ddress] address            Changes the address of the request
  cd path                      Alias for pa[th-set]
  fol[low]                     Changes the address of the request to the value
                               of the response's 'Location' header
  fragment-c[lear]             Alias for fragment-u[nset]
  fragment-s[et] fragment      Sets the fragment of the request's address
  fragment-u[nset]             Removes the fragment from the request's address
  history                      Displays previous request-response activity in
                               this session
  history-[verbose]            Displays the details of previous request-response
                               activity in this session
  ho[st-set] host              Changes the host of the request's address
  pa[th-set] path              Changes the path of the request's address
  por[t-set] port              Changes the TCP port of the request's address
  query-c[lear]                Alias for query-unset-[all]
  query-s[et] name value       Sets a query string parameter in the request's
  query-unset name             Removes a query string parameter from the
                               request's address
  query-unset-[all]            Clears the query string of the request's address
  r[euse] index                Copies a previous request by the index number
                               shown in history
  sc[heme-set] scheme          Changes the scheme (protocol identifier) of the
                               request's address
  userinfo-c[lear]             Alias for userinfo-u[nset]
  userinfo-s[et] userinfo      Sets the userinfo of the request's address
  userinfo-u[nset]             Removes the userinfo from the request's address

                               Building Requests

  body-c[lear]                 Alias for body-u[nset]
  body-req[uest]               Displays the body of the request
  body-s[et]                   Sets the body of the request
  body-u[nset]                 Clears the body of the request
  cookie-a[dd] name [value]    Alias for cookies-a[dd]
  cookie-r[emove] name         Alias for cookies-remove
  cookies                      Displays the cookies of the request
  cookies-a[dd] name [value]   Adds a cookie to the request
  cookies-c[lear]              Alias for cookies-remove-[all]
  cookies-remove name          Removes from the request the last cookie having a
                               particular name
  cookies-remove-[all]         Removes all cookies from the request
  cookies-u[se]                Uses cookies offered in the response
  header-s[et] name value      Alias for headers-s[et]
  header-u[nset] name          Alias for headers-unset
  headers-c[lear]              Alias for headers-unset-[all]
  headers-req[uest]            Displays the headers of the request
  headers-s[et] name value     Sets a header of the request
  headers-unset name           Removes a header of the request
  headers-unset-[all]          Removes all headers from the request

                              Inspecting Responses

  body[-response]              Displays the body of the response
  headers[-response]           Displays the headers of the response
  st[atus]                     Displays the status of the response


  e[xit]                       Alias for qui[t]
  hel[p] [command]             Displays this help table, or help on the
                               specified command
  qui[t]                       Quits htty

As many readers know, I’m a sucker for embedded humor, so I also got a chuckle from the exit message:

$ quit
*** Happy Trails To You!

[Source on GitHub]

Faker.js – Generate fake data in Node.js or in your browser #

Inspired by Ruby’s Faker gem and Perl’s Data::Faker, Faker.js lets you create large amounts of fake yet contextual data. Need a fake name for a form or fixture?

=> "Webster Jakubowski"

What about a zip code?

=> "07555-2886"

Company catchphrase?

=> "Multi-channelled reciprocal attitude"

There is a demo on the project homepage which is also included in the examples folder.

[Source on GitHub] [Homepage]