Project

abt

0.0
No commit activity in last 3 years
No release in over 3 years
Always Be Testing Yo! A testing framework that runs on IronWorker http://www.iron.io
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Always Be Testing!!!

A test framework that uses IronWorker to run it... constantly.

Read this blog post for background: When Unit Tests Aren't Enough... ABT - Always Be Testing.

Getting Started

First of all, the code to test must be able to check for a special config variable:

if defined? $abt_config
  @config = $abt_config
end

A real world example of using $abt_config is here: https://github.com/iron-io/iron_mq_ruby/blob/master/test/test_base.rb

Upload worker

iron_worker upload https://github.com/iron-io/abt/blob/master/abt.worker

Or (if you want to customize smth)

git clone https://github.com/iron-io/abt.git
iron_worker upload abt

Get it running

Using CLI

iron_worker queue abt -p "{\"git_url\":\"git://github.com/iron-io/iron_mq_ruby.git\",\"test_config\":{}}"

Using code(check queue.rb):

require 'iron_worker_ng'
client = IronWorkerNG::Client.new(:token => 'TOKEN', :project_id => 'PROJECT_ID')
params = {
      "git_url" => 'git://github.com/iron-io/iron_mq_ruby.git',
      "parameters" => ['--name=/test_performance.*/'],
      "test_config" => {}}

client.tasks.create('abt', params)

Add built in notifier (optional):

Using CLI

iron_worker queue abt -p "{\"notifiers\":[{\"class_name\":\"HipChatNotifier\", \"config\":{\"token\":\"HIPCHAT_TOKEN\", \"room_name\":\"AlwaysBeTesting\", \"important_room_name\":\"RoomName\", \"user_name\":\"ABT Worker\"}}], \"git_url\":\"git://github.com/iron-io/iron_worker_ruby.git\", \"test_config\":{}}}"

Using code(check queue.rb):

params.merge! {"notifiers" => [{"class_name"=>"HipChatNotifier",
                           "config"=>{"token"=>"HIPCHAT_TOKEN",
                                      "room_name"=>"AlwaysBeTesting",
                                      "important_room_name"=>"RoomName",
                                      "user_name"=>"ABT",
                                      "git_url"=>"git://github.com/SAMPLE.git"}},
                          ]}

you can add as many notifiers as you need and even make your own (read down for how to build custom notifiers).

Schedule It!

Schedule it to run regularly to ensure you're always being covered.

Using CLI

iron_worker schedule --start-at "2013-01-01T00:00:00-04:00" --run-every 600 --payload  "{\"git_url\":\"git://github.com/iron-io/iron_mq_ruby.git\",\"test_config\":{}}"

Using code

client.schedules.create('abt', params, {:start_at => Time.now,:run_every=>600})

Custom notifiers

Here's how to build your own notifiers.

Implement in your notifier the following methods:

setup configuration:

def initialize(config)
  @url = config["url"]
end

process simple text message

def send_message(message)
  puts message
end

if you want more detailed results, 'result' is an instance of Test::Unit::TestResult

def send_formatted_message(result)
 result.inspect
end

Then to use it:

worker.add_notifier(File.join(File.dirname(__FILE__), 'console_notifier'), :class_name=>'ConsoleNotifier', :config={})

Custom unit-test command line options

filter test methods by pattern:

"parameters" => ['--name=/test_performance.*/']

Webhooks