TestSwarm::Client

Simple library for interacting with TestSwarm servers. Makes it easy to create jobs, and may in future allow us to query the TestSwarm server.

Example

# Create a client to talk to the server, and get a reference to the project
# you want to submit a job to.

client  = TestSwarm::Client.new('http://testswarm.songkick.net')
project = client.project('my_project', :auth => 'abc123')

# Create the job. This checks the project out of version control, creates a
# snapshot, builds the project and determines its revision ID.

job = TestSwarm::Job.create(
  :rcs        => {
    :type     => 'git',
    :url      => 'git://github.com/songkick/foo.git'
  },

  :directory  => "/var/www/testswarm/changeset/#{project.name}",
  :build      => 'coffee -c spec/',
  :inject     => 'spec/*.html'
)

# Add test suites to the job. A test suite has a name and a URL. We can use
# the revision number to build the path to our test files.

path = "#{client.url}/changeset/#{project.name}/#{job.revision}"
['FooSpec', 'BarSpec'].each do |spec|
  job.add_suite(spec, "#{path}/spec/browser.html?spec=#{spec}")
end

# Send the job to the server, giving a name, maximum run count, and which
# browsers to run the job in. Returns the TestSwarm job ID if the job is new.

project.submit_job("My Commit #{job.revision}", job, :max => 5, :browsers => 'all')

License (MIT)

Copyright © 2012 Songkick

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.