Category Archives: Wiki

Introducing quoth: a random wikiquote gem

I just released quoth: a ruby gem that displays pseudo random wikiquotes on demand.

I really like the wikiquote gem, but it only retrieves the wikiquote of the day, so you’ll only ever run it once a day (or else see the same thing over and over again). Quoth displays a random quote from the entire wikiquote archive.


$ gem install quoth
$ quoth

The time is always right to do what is right ~ Martin Luther King, Jr.


$ irb
>> require 'quoth'
=> true
>> Quoth.get
=> "I like a huge range of comedy — from broad and farcical, the most sensitive, the most understated — but I always wanted my comedy to be more embracing of the species rather than debasing of it. ~ Lily Tomlin"
>> Quoth.refresh_quotes
=> "Successfully refreshed quotes from"

I’ll write soon about how you can use this gem in your automated testing. You can check out the source code on github. Enjoy!

Reflecting on this blog

I fired up my netbook tonight to read and reflect on some of my old blog posts. Here’s a collection of my favourite blog posts and a comment about each from my current perspective.

Five organisations I would love to work for (geography aside): Amazingly this two+ year old list is still very accurate. In 2010 I’d possibly drop 37signals from number 5 and replace them with either Thoughtworks or Mozilla or Google. Proving how great Atlassian is, Jeffrey Walker commented on this post, but very sadly, he’s no longer with us.

Software Piracy: I still stand by my views on pirated software being unnecessary, and still love my ‘biting the hand that feeds you’ analogy.

Why I do automated testing: This question still comes up (a lot) when attending job interviews. My answer is, unsurprisingly, still the same.

Version control your tests, quickly, easily, today for free: There’s still no excuse not to have version control of your automated tests. Please do it.

Create fancy wiki home pages with Confluence, Lozenge and Nuvola Icons: A dead simple way to create an attractive Confluence home page with free icons.

Weird ways of working, car indicators, and shoshin: The thing that amazes me today about my eight month year old son is his shoshin, and how he contributes to my own.

Running Watir tests from a Confluence wiki page: Some cool stuff I wish I could use more in my day job. One day.

Five reasons starting with F on why I use Watir: Again, two+ years later and all the reasons are still relevant.

Let me know if you have any favourites or would like me to write about something in particular in the future.

Update 20 July 2010:

Somehow I forgot this post I am really proud of: Software Testing Career Development

Easily define Watir tests in excel, OO, wikis and Google docs using Roo

I spent this evening playing with Roo, the ruby library for reading data from spreadsheets and I am very impressed. In a very small amount of time I was able to define tests in four different forms/places and could execute my tests from each of these:

  • An Excel file (.xls): stored locally
  • An OpenOffice (.ods): stored locally
  • An Excel file (.xls) stored in a Confluence wiki page with Confluence Office Connector; and
  • A Google Docs spreadsheet.

The great thing about Roo is that you don’t actually need Excel; Roo simply reads the file, unlike the ruby Excel COM WIN32 API I have used previously.

The spreadsheet (embedded in Confluence) looks like this:


The cool thing about embedding it in Confluence is that you can click the title of the spreadsheet to edit it (in OpenOffice in my case).

I made some minor changes to my existing code that executed my depot tests from a wiki page, and it was as easy as that. A data driven Watir solution with four possible ways to define test cases. Cool.

You can find all the code needed below.

require 'watir'
require 'rubygems'
require 'roo'
require './Customer.rb'
require './Common.rb'

case ARGV[0]
when "excel"
	ss ="watirmelon.xls")
when "wiki"
	ss ="http://localhost:8080/download/attachments/2097153/watirmelon.xls")
when "gdocs"
	ss ="")
	ss ="watirmelon.ods")

ss.default_sheet = ss.sheets.first
ss.first_row.upto(ss.last_row) do |line|
	if ss.cell(line,1).strip != "Function" then #We have an executable test
			module_name = ss.cell(line,1).strip
			method_name = ss.cell(line,2).downcase.strip.sub(' ','_') # automatically determine function name based upon method name.
			comments = ss.cell(line,3).strip
			expected_outcome = ss.cell(line,4).strip
			expected_error = ss.cell(line,5).strip
			required_module = Kernel.const_get(module_name)
			required_method = required_module.method(method_name)
			arity = required_method.arity() # this is how many arguments the method requires, it is negative if a 'catch all' is supplied.
			arity = ((arity * -1) - 1) if arity < 0
			parameters = []
			1.upto(arity) do |p|
			actual_outcome, actual_output =*parameters)
			# determine the result.
			if (expected_outcome = 'Success') and actual_outcome then
			    result = "PASS"
			elsif (expected_outcome = 'Error') and (not actual_outcome) and (expected_error = actual_output) then
			    result = "PASS"
			    result = "FAIL"
			puts "\nRunning Test: #{method_name} for #{module_name}."
			puts "Expected Outcome: #{expected_outcome}."
			puts "Expected Error: #{expected_error}."
			puts "Actual Outcome: #{actual_outcome}."
			puts "Actual Output: #{actual_output}."
			puts "RESULT: #{result}"
			puts "An error occurred: #{$!}"

See the full test code below the break.

Continue reading

Create fancy wiki home pages with Confluence, Lozenge and Nuvola icons

I think that it’s important to have nice looking wiki pages, especially for those high level pages that are viewed by a large audience. I’ve put this post together to explain how to setup Atlassian’s Confluence wiki with some freely available macros and icons to make fancy wiki pages to impress.


1) Atlassian Confluence

You need a running instance of Atlassian’s Confluence Wiki – you can get a free 30 day trial or free personal server license for personal use.

2) Content Formatting Macro

You need to have the free Content formatting macros installed. This can be easily done in Confluence under Administration->Plugin Repository.

3) Nuvola Icon sets attached to Confluence

You need to download the Nuvola icon set locally and attach these to your Confluence instance. Nuvola is a elegant looking icon set released free under LGPL.

Download this file, then unpack it (on Windows use something like 7-Zip), then upload all the 48×48 icons to new wiki pages in Confluence using the Confluence File Uploader that conviently runs directly from your browser.

I created five separate wiki pages under a master page called ‘Icons‘. I called these icons pages: ‘Icons Actions‘, ‘Icons Apps‘, ‘Icons Devices‘, ‘Icons Filesystems‘ and ‘Icons Mimetypes‘. You can create these pages under any space, so if you have an admin type space you’re probably best to use that.

You should put {gallery:columns=8} in each icon wiki page so the icons appear as thumbnails. You can put {children} in your Icons page to display the other child icon page names.

Creating the Actual Page

Creating the actual page is pretty easy once you have all the icons uploaded. The page uses three macros: columns, sections and lozenges. It’s a matter of reading the doco for each and experimenting with what looks best. I’ve posted my wiki source below.

You can then easily create a page template with some icons and blank labels so that others who use your wiki can easily create pages that look like this.

The Result

The final result
The final result - click to enlarge

Source code is posted below.

Continue reading