<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>This is where I record my rants, comment, quotes and thoughts on things.  I welcome your input, please fire away.

Find out more about me at:
http://mattheworiordan.com

 
//
		 
//
		</description><title>Matthew O'Riordan</title><generator>Tumblr (3.0; @mattheworiordan)</generator><link>http://blog.mattheworiordan.com/</link><item><title>How elastic are Amazon Elastic Load Balancers (ELB)?  Not very it seems</title><description>&lt;blockquote&gt;
&lt;p&gt;Update: Since I made this post, Amazon have in fact been in touch and have been extremely helpful looking into this issue and running numerous tests to ensure ELB is performing as it should.  As soon as we have completed running all tests and conclusive findings, I will make another follow up post detailing the results.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Recently I&amp;#8217;ve been working on a project that will feasibly need to respond to 10,000+ SSL web socket connection requests per second, and I&amp;#8217;ve been racking my brain as to figure out what type of infrastructure I would need to cope with that.  &lt;/p&gt;
&lt;p&gt;I did some initial tests and determined that a single CPU instance on EC2 (with 1 EC2 compute power) can cope with a measly 25 SSL handshakes per second.  Based on my 10k target, that means I would need 400 CPU instances on EC2 just to deal with handshakes.  I soon learn that the certificate key size is paramount, and dropping from the normal 2048 bit key down to 1024 bit improves performance 5 fold, so that now means I only need 80 CPU instances.  Still way too many instances, and to be honest, not a piece of architecture I particularly want to look after either as I will need to build a system that can auto-scale on demand.&lt;/p&gt;
&lt;p&gt;So I started experimenting with Amazon&amp;#8217;s Elastic Load Balancers on the premise that they are &lt;strong&gt;elastic&lt;/strong&gt;. I ran some quick apache bench tests against an ELB server and unsurprisingly got 25 SSL handshakes per second throughput with a 2048 bit key.  So I can deduce that an ELB when it starts out is simply a single CPU instance on EC2.  I then tried to run apache bench for 30 minutes to see how ELB scales, but unfortunately quickly discovered that that type of test is quite contrived, and ELB scales out dynamically using DNS.  So a single load test client would only ever hit one ELB instance, and as such, ELB may not scale as only one IP is hitting it and even if it did, the client would never be able to benefit from that scaling.&lt;/p&gt;
&lt;p&gt;So I went ahead and built a load testing farm of daemons that distribute their &amp;#8220;attack&amp;#8221; on the ELB from loads of different IP addresses (I spun up 40+ micro instances on EC2), and will cleverly keep querying DNS to see when ELB scales and distribute traffic to the new IP addresses that ELB responds to for its public DNS name.&lt;/p&gt;
&lt;p&gt;And my findings were interesting, and disappointing.  It seems that ELB does in fact scale, but for some reason I am hitting a hard limit for some reason or another.  Perhaps Amazon have set a hard limit for some reason, perhaps I need to have something enabled on my account, or perhaps ELB is just not as elastic as it&amp;#8217;s claimed to be.  I&amp;#8217;ll only find out if Amazon get in touch with me to explain ;)&lt;/p&gt;
&lt;p&gt;Here is a graph demonstrating the attempted requests per second from my load testing daemons that scaled up request from 50 per second in minute one, up to 6,000 requests per second in the 120th minute.  As you can see, other than a few more small upward blips, ELB pretty much flattens out at around 2,000 requests per second with a 1024 bit key and ELB spread across 3 zones (and thus 3 instances).&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_m0uidv27MT1qargzy.png"/&gt;&lt;/p&gt;
&lt;p&gt;If anyone has any suggestions or feedback on how to make ELB scale as it should, please do get in touch.  I&amp;#8217;ve posted my findings into the Amazon forums &lt;a href="https://forums.aws.amazon.com/message.jspa?messageID=282843#282843"&gt;here&lt;/a&gt; and &lt;a href="https://forums.aws.amazon.com/message.jspa?messageID=321341#321341"&gt;here&lt;/a&gt;, &lt;strike&gt;but I have little hope that Amazon themselves will respond&lt;/strike&gt; (see below, Amazon did get in touch and have been brilliant!).&lt;/p&gt;
&lt;p&gt;In the mean time, it looks like I&amp;#8217;ll be finding another solution.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Update: Since I made this post, Amazon have in fact been in touch and have been extremely helpful looking into this issue and running numerous tests to ensure ELB is performing as it should.  As soon as we have completed running all tests and conclusive findings, I will make another follow up post detailing the results.&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://blog.mattheworiordan.com/post/19257368025</link><guid>http://blog.mattheworiordan.com/post/19257368025</guid><pubDate>Tue, 13 Mar 2012 22:56:00 +0000</pubDate></item><item><title>MaxCDN versus Amazon Cloudfront</title><description>&lt;p&gt;Following on from my &lt;a href="http://blog.mattheworiordan.com/post/13451657374/maxcdn-review-seriously-unreliable"&gt;bad experience with MaxCDN in November&lt;/a&gt;, I thought it would be worth a follow up post for those who are interested in how &lt;a href="http://www.maxcdn.com/"&gt;MaxCDN&lt;/a&gt; stacks up against &lt;a href="http://aws.amazon.com/cloudfront/"&gt;Amazon Cloudfront&lt;/a&gt;.  All my experience is based on production issues I have had with &lt;a href="http://easybacklog.com"&gt;easyBacklog, a simple backlog management tool designed for agencies&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;On a positive note, after the outage in November and my numerous support requests, MaxCDN got in touch, apologised for not responding and resolving the issue in a sensible amount of time, and in fact offered me a credit note for all the money I had spent with them to date.  +1 for them caring and doing something about it.&lt;/p&gt;
&lt;p&gt;However, things did not get better from that point forwards.  As a result of the CDN had  going down and taking most of my site with it, I thought I should now add monitoring to the CDN.  I must admit, I never thought one would need to monitor a CDN that is designed to achieve the five 9s, &lt;a href="http://edgedirector.com/htm/9999.htm"&gt;99.999% uptime&lt;/a&gt;, but clearly I was not willing to take the chance again.&lt;/p&gt;
&lt;p&gt;So I set up two kinds of monitors:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Monitors from 3 global locations to cacheable assets i.e. the CDN should not have to contact my server at all and should be serving these assets from the cache.&lt;/li&gt;
&lt;li&gt;Monitors from 3 global locations to non-cacheable assets i.e. the CDN has to reload this asset for every HTTP request.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;The reason I took this approach is that whilst it&amp;#8217;s great that a CDN may be delivering cached assets efficiently, I also want to be sure that each time I do a deploy, it will load up the new assets efficiently as well.&lt;/p&gt;
&lt;p&gt;And this is where it all went wrong with MaxCDN, see the graph I sent to their support team below:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_lzssz5YMHo1qargzy.png"/&gt;&lt;/p&gt;
&lt;p&gt;All of those red dots means their CDN server did not respond within 10s.  Yes, 10 whole seconds.  This is a CDN for god&amp;#8217;s sake, what is going on here.  I ran simultaneous tests directly to the origin server for the same URL and the response times was never more than 750ms, meaning the CDN can for newly deployed assets simply timeout and never serve the assets.&lt;/p&gt;
&lt;p&gt;I spoke with MaxCDN numerous times about this issue, and whilst they were doing their best to help, they never managed to resolve the issue.  The only thing they did at one point was to move me onto a new type of infrastructure that did not support querystring cache invalidation, and in the process they took my site down for another hour.  Thanks MaxCDN.&lt;/p&gt;
&lt;p&gt;So here is why I thought I should write a blog post.  Previously I was using &lt;a href="http://documentcloud.github.com/jammit/"&gt;Jammit&lt;/a&gt; and &lt;a href="http://www.maxcdn.com/"&gt;MaxCDN&lt;/a&gt; with &lt;a href="http://rubyonrails.org/"&gt;Rails&lt;/a&gt; 3.0 that uses a querystring after the asset URLs to ensure they are not cached.  Unfortunately Amazon Cloudfront ignores the querystring, so assets are never refreshed.  Hence, I had to use &lt;a href="http://www.maxcdn.com/"&gt;MaxCDN&lt;/a&gt; as they do support querystrings for assets.  So I bit the bullet, upgraded to Rails 3.2, removed Jammit and upgraded to the asset pipeline (&lt;a href="https://github.com/sstephenson/sprockets"&gt;Sprockets&lt;/a&gt;).  All assets are now precompiled with fingerprints in the URL such as /assets/my-image-au32h121wehqweq.png meaning I can use Cloudfront.&lt;/p&gt;
&lt;p&gt;So I changed over to Amazon Cloudfront yesterday and here is how it stacks up:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_lzsta2sUiY1qargzy.png"/&gt;&lt;/p&gt;
&lt;p&gt;CloudFront is bloody amazing, not a single spike for non cacheable assets above a few hundred milliseconds, and regardless of location it&amp;#8217;s working brilliantly and super fast.&lt;/p&gt;
&lt;p&gt;So in the debate of MaxCDN vs Amazon Cloudfront here is my take:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;MaxCDN&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Simple to set up and priced right&lt;/li&gt;
&lt;li&gt;Allows the use of custom aliases such as easybacklog.netdna-ssl.com&lt;/li&gt;
&lt;li&gt;Supports SSL&lt;/li&gt;
&lt;li&gt;Feature rich, supports querystring invalidation amongst other things&lt;/li&gt;
&lt;li&gt;Nice admin interfaces&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Unreliable, I have experienced a number of outages&lt;/li&gt;
&lt;li&gt;Support is not great when needed&lt;/li&gt;
&lt;li&gt;Performance is sub-par&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;Amazon Cloudfront&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Simple to set up and priced right&lt;/li&gt;
&lt;li&gt;Supports SSL&lt;/li&gt;
&lt;li&gt;Unbelievably reliable&lt;/li&gt;
&lt;li&gt;Performance is incredible&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Not as feature rich as some other offerings, but at least you know what is on offer works well&lt;/li&gt;
&lt;li&gt;&lt;a href="http://stackoverflow.com/questions/5164569/cloudfront-serving-over-own-ssl-certificate"&gt;Does not support custom SSL certificates for CNAME resolution of assets&lt;/a&gt;, so for SSL you have to use ugly cloudfront.net domains&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Get in touch if your experience differs from mine.  So far, I am very pleased with Cloudfront.&lt;/p&gt;</description><link>http://blog.mattheworiordan.com/post/18070022782</link><guid>http://blog.mattheworiordan.com/post/18070022782</guid><pubDate>Wed, 22 Feb 2012 14:29:17 +0000</pubDate></item><item><title>MaxCDN review - seriously unreliable</title><description>&lt;div&gt;
&lt;p&gt;&lt;em&gt;* Update 22 Feb 2012: Read my follow on post &lt;a href="http://blog.mattheworiordan.com/post/18070022782/maxcdn-versus-amazon-cloudfront"&gt;MaxCDN versus Amazon Cloudfront&lt;/a&gt; *&lt;/em&gt; &lt;/p&gt;
&lt;p&gt;I know, this post will probably come across as a rant, but it&amp;#8217;s not.  I have recently launched my business (&lt;a href="http://easybacklog.com"&gt;Easybacklog - &lt;/a&gt;&lt;a href="http://easybacklog.com"&gt;&lt;a href="http://easybacklog.com"&gt;http://easybacklog.com&lt;/a&gt;&lt;/a&gt;) into public beta and every customer and client I attract is valuable to me.  So when my CDN goes down, and therefore my site is effectively unusable as all stylesheets, Javascript and images have not loaded, I get upset because I might lose customers.&lt;/p&gt;
&lt;p&gt;To give you some background, recently I looked around for a CDN to help speed up the loading of my site&amp;#8217;s assets.  I looked into numerous options, and found &lt;a href="http://www.maxcdn.com/"&gt;MaxCDN&lt;/a&gt; to be my number one choice (second to &lt;a href="http://aws.amazon.com/cloudfront/"&gt;Amazon CloudFront&lt;/a&gt;).  And to be fair, setting up was reasonably painless (other than issues with payment which meant my account was locked), and I was up and running in no time at all.&lt;/p&gt;
&lt;p&gt;And then yesterday it all went wrong, and it stayed like that.  At around 11am UK time I found that the site&amp;#8217;s asset hosting was no longer working.  Firstly the assets were not being served, and secondly the SSL certificate being issued was the wrong one, meaning there was zero chance of my assets being served.  Mistakes happen, and I can handle that.&lt;/p&gt;
&lt;p&gt;What frustrates me, and has motivated me to post this blog post so as to warn others about MaxCDN&amp;#8217;s terrible customer service, is that I could not get hold of anyone at MaxCDN.  On their home page, they state 24/7/365 support (screenshotted below):&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_lvdfdhonuc1qargzy.png"/&gt;&lt;/p&gt;
&lt;p&gt;So as my site was down as this was pretty critical I endeavoured to get in touch with MaxCDN by:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Calling them (no answer, got a voicemail which disconnected and wouldn&amp;#8217;t let me leave a message)&lt;/li&gt;
&lt;li&gt;Emailed them (no response)&lt;/li&gt;
&lt;li&gt;Tweeted them (no response)&lt;/li&gt;
&lt;li&gt;Used their contact form (no response)&lt;/li&gt;
&lt;li&gt;Used their live chat feature (no response)&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Eventually, 10 hours later, I managed to get hold of someone using their live chat feature (still no response to any of my emails), and that was the icing on the cake.  He told me two things in our live chat:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Sorry, but it&amp;#8217;s the weekend, so we don&amp;#8217;t have any engineers available.  Someone will get back to you on Monday.&lt;/li&gt;
&lt;li&gt;Sorry, but MaxCDN is lower priority than NetNDA (I assume their parent / provider), so we&amp;#8217;ll get to your issue when we can.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;So I warn you all, if you want a CDN that is reliable, do not even dream of using MaxCDN. I am absolutely flabbergasted that a company touting itself as a CDN would find it acceptable to not fix an issue until the following day.  (They have fixed my issue now, 20 hours later, and without an apology)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;So who would I recommend as an alternative?  &lt;br/&gt;&lt;/strong&gt;Well I&amp;#8217;m looking into that now and hope to post an update in here once I have had some experience using the competitors.  The ones I am trying support pay per usage models (i.e. no fixed subscription) and are as follows:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://aws.amazon.com/cloudfront/"&gt;Amazon CloudFront&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.softlayer.com/"&gt;Softlayer&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.cachefly.com/"&gt;CacheFly&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Do tell me if you also experience bad support with MaxCDN so that hopefully others considering MaxCDN will not fall into the same trap that I did.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;* Update 22 Feb 2012: Read my follow on post &lt;a href="http://blog.mattheworiordan.com/post/18070022782/maxcdn-versus-amazon-cloudfront"&gt;MaxCDN versus Amazon Cloudfront&lt;/a&gt; *&lt;/em&gt; &lt;/p&gt;
&lt;/div&gt;</description><link>http://blog.mattheworiordan.com/post/13451657374</link><guid>http://blog.mattheworiordan.com/post/13451657374</guid><pubDate>Mon, 28 Nov 2011 12:57:00 +0000</pubDate></item><item><title>URL regular expression for links with or without the protocol</title><description>&lt;p&gt;I&amp;#8217;ve just come across a pretty common requirement to convert any text that looks like a link into a link within some HTML text.  Strangely, after searching for a good 15 minutes for a regular expression, all I could find was either a regular expressions which detects URLs with a protocol such as &lt;a href="http://mattheworiordan.com/,"&gt;http://mattheworiordan.com/,&lt;/a&gt; or a regular expression which detects URLs without such as &lt;a href="http://www.mattheworiordan.com"&gt;www.mattheworiordan.com&lt;/a&gt;.  Why the hell I could not find one which does both is beyond me, so here I go at posting a solution for anyone else to use.&lt;/p&gt;
&lt;p&gt;Here is the holy grail:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;strong&gt;/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[&amp;#45;;:&amp;amp;=\+\$,\w]+@)?[A-Za-z0-9&amp;#46;&amp;#45;]+|(?:www&amp;#46;|[&amp;#45;;:&amp;amp;=\+\$,\w]+@)[A-Za-z0-9&amp;#46;&amp;#45;]+)((?:\/[\+~%\/&amp;#46;\w&amp;#45;_]*)?\??(?:[&amp;#45;\+=&amp;amp;;%@&amp;#46;\w_]*)#?(?:[&amp;#46;\!\/&amp;#92;\w]*))?)/&lt;/strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Here is a nice example of this regular expression in action &lt;a href="http://jsbin.com/eqocuh/5/edit#source"&gt;&lt;a href="http://jsbin.com/eqocuh/5/edit#source"&gt;http://jsbin.com/eqocuh/5/edit#source&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Please feel free to modify this JSBin, add examples, and update this regular expression, and I will update within this blog post.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Here is an explanation of the regular expression for those who care&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;(
 ( # brackets covering match for protocol (optional) and domain
  ([A-Za-z]{3,9}:(?:\/\/)?)   # match protocol, allow in format http:// or mailto:
  (?:[\-;:&amp;amp;=\+\$,\w]+@)?   # allow something@ for email addresses
  [A-Za-z0-9\.\-]+   # anything looking at all like a domain, non-unicode domains&lt;br/&gt;  | # or instead of above&lt;br/&gt;  (?:www\.|[\-;:&amp;amp;=\+\$,\w]+@) # starting with something@ or www.&lt;br/&gt;  [A-Za-z0-9\.\-]+   # anything looking at all like a domain&lt;br/&gt; )&lt;br/&gt; ( # brackets covering match for path, query string and anchor&lt;br/&gt;  (?:\/[\+~%\/\.\w\-]*)  # allow optional /path&lt;br/&gt;  ?\??(?:[\-\+=&amp;amp;;%@\.\w]*)  # allow optional query string starting with ? &lt;br/&gt;  #?(?:[\.\!\/\\\w]*) # allow optional anchor #anchor &lt;br/&gt; )? # make URL suffix optional&lt;br/&gt;)&lt;/pre&gt;</description><link>http://blog.mattheworiordan.com/post/13174566389</link><guid>http://blog.mattheworiordan.com/post/13174566389</guid><pubDate>Tue, 22 Nov 2011 22:33:00 +0000</pubDate></item><item><title>Infinite scrolling tab system for JQuery</title><description>&lt;p&gt;Google Docs Spreadsheets has a useful worksheet tab system whereby if there are more tabs than the space available, a scroller device automatically appears.  Whilst building the new sprints functionality for my &lt;a href="http://easybacklog.com/"&gt;backlog management tool&lt;/a&gt; &lt;a href="http://easybacklog.com/"&gt;easyBacklog&lt;/a&gt;, I went on a search for a scrolling tab system and couldn&amp;#8217;t find one.&lt;/p&gt;
&lt;p&gt;So I&amp;#8217;ve built a JQuery plugin inspired by the Google Docs Spreadsheet tab system, along with the &lt;a href="http://css-tricks.com/14001-tabs-with-round-out-borders/"&gt;rounded tabs solution by Chris Coyier&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Check out the plugin at &lt;a href="https://github.com/mattheworiordan/jquery.infinite.tabs"&gt;&lt;a href="https://github.com/mattheworiordan/jquery.infinite.tabs"&gt;https://github.com/mattheworiordan/jquery.infinite.tabs&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Comments / feature requests / bug reports welcome.&lt;/p&gt;</description><link>http://blog.mattheworiordan.com/post/11327427766</link><guid>http://blog.mattheworiordan.com/post/11327427766</guid><pubDate>Tue, 11 Oct 2011 21:38:20 +0100</pubDate></item><item><title>Setting up a Jenkins (old Hudson) Continuous Integration Server </title><description>&lt;p&gt;Following on from my recent full stack integration work on &lt;a href="http://easybacklog.com"&gt;easyBacklog, the Agile Project Management app&lt;/a&gt; I am building, I have set up a Continuous Integration server which will run both unit tests and integration tests across the entire app each time I push a commit.  In order to do this, I needed full support for &lt;a href="http://seleniumhq.org/"&gt;Selenium&lt;/a&gt; and &lt;a href="https://github.com/thoughtbot/capybara-webkit"&gt;Capybara-Webkit&lt;/a&gt;, along with Cucumber and RSpec.&lt;/p&gt;
&lt;p&gt;I looked at various CI solutions:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.jetbrains.com/teamcity/"&gt;TeamCity&lt;/a&gt; - looked really good, but very .NET and Java focussed so that put me off&lt;/li&gt;
&lt;li&gt;&lt;a href="http://integrityapp.com/"&gt;Integrity&lt;/a&gt; - looks like it&amp;#8217;s no longer maintained&lt;/li&gt;
&lt;li&gt;&lt;a href="http://cruisecontrolrb.thoughtworks.com/documentation"&gt;CruiseControl.rb&lt;/a&gt; - not much documentation for it, and not a huge amount of community interest it seems&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jenkins-ci.org/"&gt;Jenkins&lt;/a&gt; - split from Hudson when they became commercial, and seems to be the big daddy and very well supported in the community.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;So I opted for Jenkins and went about setting up a CI server on my Mac Mini with OS X Lion.&lt;/p&gt;
&lt;p&gt;As I couldn&amp;#8217;t find any easy guides on what to do, I &lt;strong&gt;&lt;em&gt;loosely&lt;/em&gt; &lt;/strong&gt;documented the steps I followed to get my CI server up and running so that hopefully others trying to do the same thing will have a good starting point.  Here is a simple chronological log of what I did:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Note: I am pulling my working directory from a local Git repository.  If you want to use Github, then install the Github plugin (see below) and figure that part out yourself!&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Log into your Mac with your admin account&lt;/p&gt;
&lt;p&gt;Install Homebrew: &lt;em&gt;/usr/bin/ruby -e &amp;#8220;$(curl -fsSL &lt;a href="https://raw.github.com/gist/323731"&gt;https://raw.github.com/gist/323731&lt;/a&gt;)&amp;#8221;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;If you have Homebrew installed already, then I would advise you `&lt;em&gt;brew update&lt;/em&gt;` to get the latest recipes&lt;/p&gt;
&lt;p&gt;Install Qt (needed by Capybara-Webkit): &lt;em&gt;brew install qt &amp;#8212;build-from-source&lt;br/&gt;&lt;/em&gt;Note, this will take over an hour to build, so make yourself a nice cuppa and wait.&lt;br/&gt;Whilst this is happening, I would go ahead and install Firefox which is needed for the standard Selenium install. &lt;/p&gt;
&lt;p&gt;Install Jenkins using the native installer, &lt;a href="http://mirrors.jenkins-ci.org/"&gt;&lt;a href="http://mirrors.jenkins-ci.org/"&gt;http://mirrors.jenkins-ci.org/&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Server should be running, if not, reboot the machine as on Mac OS X a LaunchDaemon is installed by Jenkins.&lt;/p&gt;
&lt;p&gt;Go to &lt;a href="http://localhost:8080"&gt;http://localhost:8080&lt;/a&gt;, Manage, Manage Plugins, and install Jenkins Git, Hudson Ruby and Jenkins ruby metrics&lt;/p&gt;
&lt;p&gt;I would also advise you set up security for your Jenkins server.  Go to Manage Jenkins, Configure System, choose &amp;#8220;Jenkins&amp;#8217;s own user database&amp;#8221; under &amp;#8220;Access Control&amp;#8221; and the rest is reasonably self-explanatory.&lt;/p&gt;
&lt;p&gt;If you want email notifications when builds succeed or fail, then you will either need an SMTP server you can use, or you can configure OS X to run postfix.  See the following articles to get postfix running on Mac OS X:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.phase2technology.com/node/667/"&gt;&lt;a href="http://www.phase2technology.com/node/667/"&gt;http://www.phase2technology.com/node/667/&lt;/a&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://discussions.apple.com/thread/3247974?start=0&amp;amp;tstart=0"&gt;&lt;a href="https://discussions.apple.com/thread/3247974?start=0&amp;amp;tstart=0"&gt;https://discussions.apple.com/thread/3247974?start=0&amp;amp;tstart=0&lt;/a&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://discussions.apple.com/thread/3247974?start=0&amp;amp;tstart=0"&gt;&lt;a href="http://serverfault.com/questions/42519/how-to-correct-postfix-relay-access-denied-problem"&gt;http://serverfault.com/questions/42519/how-to-correct-postfix-relay-access-denied-problem&lt;/a&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Set up a user called jenkins in OSX (login jenkins).&lt;/p&gt;
&lt;p&gt;Modify the file /Library/LaunchDaemon/org.jenkins-ci.plist, remove the GroupName and daemon value and then change UserName to jenkins&lt;/p&gt;
&lt;p&gt;You will now need to change the permissions on a folder Jenkins uses, run the following:&lt;br/&gt;&lt;em&gt;sudo chown -R jenkins:wheel /Users/Shared/Jenkins&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Now reboot, and make sure Jenkins is still up and running (&lt;a href="http://localhost:8080"&gt;http://localhost:8080&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;Log into your OS X box with the jenkins account&lt;/p&gt;
&lt;p&gt;Install RVM: &lt;em&gt;bash &amp;lt; &amp;lt;(curl -s &lt;a href="https://rvm.beginrescueend.com/install/rvm"&gt;https://rvm.beginrescueend.com/install/rvm&lt;/a&gt;)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Install ruby: &lt;em&gt;rvm install 1.9.2&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Ensure 1.9.2 is default: &lt;em&gt;rvm &amp;#8212;default install 1.9.2&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Reload your console, and type &lt;em&gt;rvm list&lt;/em&gt;.  Ruby 1.9.2 should be selected.  If not, your default Ruby 1.9.2 is not working.&lt;/p&gt;
&lt;p&gt;Now install the Bundler gem, `&lt;em&gt;gem install bundler&lt;/em&gt;`&lt;/p&gt;
&lt;p&gt;Now before you set up your first job in Jenkins, I would advise that you make sure the jenkins user account has everything needed to actually run Rake and RSpec.  So to do this, simply go to the console, create a working folder and git clone git://your-git-respository-url.git to get a working version of the files onto the server.  &lt;br/&gt;Run `&lt;em&gt;bundle install &amp;amp;&amp;amp; RAILS_ENV=test bundle exec rake db:migrate &amp;amp;&amp;amp; RAILS_ENV=test bundle exec rake&lt;/em&gt;`.  Your Cucumber tests (and Unit tests if you have some) should run.  If they don&amp;#8217;t pass, figure out why not before you get Jenkins to start automatically building for you.&lt;/p&gt;
&lt;p&gt;To set up your CI job, go to Jenkins home page (&lt;a href="http://localhost:8080"&gt;http://localhost:8080&lt;/a&gt;), click New Job, and set the following:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Name the job, and select &amp;#8220;Build a free-style software project&amp;#8221;, then click Next&lt;/li&gt;
&lt;li&gt;I opted for &amp;#8220;Discard Old Builds&amp;#8221; and kept the last 30 builds&lt;/li&gt;
&lt;li&gt;I chose Git and entered the URL (local path) to my Git repository.  This could of course be a public Git repository, but make sure when you are logged in as jenkins on your Mac that the repository is accessible.  Set up public key / private key authentication if necessary.&lt;/li&gt;
&lt;li&gt;Under build triggers, choose Poll SCM.  I entered * * * * which means I poll the SCM every minute.  If this is a remote repository, then I would suggest you do something like 0,15,30,45 * * * to poll every 15 minutes.&lt;/li&gt;
&lt;li&gt;Add a build step, &amp;#8220;Execute Shell&amp;#8221; and use something like this:&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;em&gt;&lt;span&gt;#!/bin/bash -eexport RAILS_ENV=test&lt;/span&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;span&gt;source “$HOME/.rvm/scripts/rvm”&lt;/span&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;span&gt;rvm use 1.9.2&lt;/span&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;span&gt;bundle install &amp;#8212;deployment&lt;/span&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;span&gt;bundle exec rake db:migrate spec&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Under email notifications I would put in your email address for notifications.&lt;/li&gt;
&lt;li&gt;I have not yet looked into the Rails / Ruby specific plugins and how to use them, so for now leave these blank.&lt;/li&gt;
&lt;li&gt;Save your job&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;You can then manually start the build by going to the home page, clicking on the title of your build, and clicking Build Now.  You should see the status of the build in the Build History (bottom left), and if you click on the Build in progress, and then on Console Output, you can monitor the build as it happens.&lt;/p&gt;
&lt;p&gt;Now that you have SCM polling, each time you push a change to your Git repository, a new build should automatically fire off.  &lt;/p&gt;
&lt;p&gt;Do give me feedback if I&amp;#8217;ve missed out any steps.  Unfortunately I wrote down a lot of these steps retrospectively.&lt;/p&gt;</description><link>http://blog.mattheworiordan.com/post/9667774436</link><guid>http://blog.mattheworiordan.com/post/9667774436</guid><pubDate>Thu, 01 Sep 2011 16:31:00 +0100</pubDate></item><item><title>A library for simulating a drag event with a JQuery UI Sortable widget</title><description>&lt;p&gt;&lt;span&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I have been working on thorough integration testing of my new &lt;a href="http://easybacklog.com/"&gt;Agile Project Management tool called easyBacklog&lt;/a&gt;, and came across a problem whereby it seems there is no easy way to test / simulate drag and drop events with a JQuery UI Sortable widget.&lt;/p&gt;
&lt;p&gt;Whilst &lt;a href="https://github.com/eduardolundgren/jquery-simulate"&gt;jquery.simulate.js&lt;/a&gt; provides functionality to simulate many JQuery and JQuery UI event, it is unable to simulate a drag event for a JQuery UI Sortable widget due to the intricate behaviour needed to make the JQuery UI Sortable widget fire the correct events.&lt;/p&gt;
&lt;p&gt;So I&amp;#8217;ve developed a library to solve this problem: it allows you to simulate Drag events for a &lt;a href="http://jqueryui.com/demos/sortable/"&gt;JQuery UI Sortable&lt;/a&gt;, and supports a number of useful features.&lt;/p&gt;
&lt;p&gt;Go to the Github repository &lt;a href="https://github.com/mattheworiordan/jquery.simulate.drag-sortable.js"&gt;jquery.simulate.drag-sortable.js&lt;/a&gt; for the code and the tests.&lt;/p&gt;</description><link>http://blog.mattheworiordan.com/post/9332346229</link><guid>http://blog.mattheworiordan.com/post/9332346229</guid><pubDate>Wed, 24 Aug 2011 13:56:03 +0100</pubDate></item><item><title>Testing :focus with JQuery and Selenium or Capybara-Webkit</title><description>&lt;p&gt;Recently whilst trying to write integration tests for a JQuery heavy front end application, I came across a very strange issue when testing to see if an element has focus.&lt;/p&gt;
&lt;p&gt;What I found is that if an element has focus, yet the actual browser or tab does not have focus, then using the pseudo selector &lt;strong&gt;:focus&lt;/strong&gt; from &lt;a href="http://jquery.com/"&gt;JQuery&lt;/a&gt; (or &lt;a href="http://sizzlejs.com/"&gt;Sizzle&lt;/a&gt;) will not find the focussed item.  Putting it another way, the browser and web page must have the focus in the OS for the &lt;strong&gt;:focus&lt;/strong&gt; selector to work.  &lt;/p&gt;
&lt;p&gt;A simple way to replicate this issue is to go to &lt;a href="http://jsbin.com/abozas"&gt;&lt;a href="http://jsbin.com/abozas"&gt;http://jsbin.com/abozas&lt;/a&gt;&lt;/a&gt;, open up your Javascript console, and type the following commands&lt;/p&gt;
&lt;pre class="prettyprint"&gt;$('#inpt').focus();
$('#inpt').is(':focus');
&lt;/pre&gt;
&lt;p&gt;As you have just put the focus on #inpt, you would expect it to retain focus and thus pass a JQuery test of .is(&amp;#8216;:focus&amp;#8217;);  However, because the Javascript console has the focus, and not the web page, .is(&amp;#8216;:focus&amp;#8217;) will always return false.&lt;/p&gt;
&lt;p&gt;Now generally this is not an issue as your web page actually has focus, but unfortunately I discovered that in Rails when using &lt;a href="http://cukes.info/"&gt;Cucumber&lt;/a&gt;, &lt;a href="https://github.com/jnicklas/capybara"&gt;Capaybara&lt;/a&gt; and &lt;a href="https://github.com/thoughtbot/capybara-webkit"&gt;Capybara-Webkit&lt;/a&gt; and/or &lt;a href="http://seleniumhq.org/"&gt;Selenium&lt;/a&gt; and testing for &lt;strong&gt;:focus&lt;/strong&gt;, all tests will fail because the browser window does not have the focus of the OS at the time it is run.&lt;/p&gt;
&lt;p&gt;So firstly I logged this is &lt;a href="https://github.com/thoughtbot/capybara-webkit/issues/135"&gt;an issue with Capybara-Webkit&lt;/a&gt;, and in the mean time I&amp;#8217;ve worked up a workaround solution by poking around in JQuery and Sizzle (the CSS selector engine that powers not only JQuery, but also &lt;a href="http://prototypejs.org/"&gt;Prototype&lt;/a&gt;, &lt;a href="http://dojotoolkit.org/"&gt;Dojo&lt;/a&gt;, &lt;a href="http://www.mochikit.com/"&gt;MochiKit&lt;/a&gt;, &lt;a href="http://tinymce.moxiecode.com/"&gt;TinyMCE&lt;/a&gt;).  I discovered that the issue is in fact not with the Sizzle selector logic, but resides with some optimizations that Sizzle uses for performance reasons.  For the function matchesSelection, it tries to first use the native method webKitMatchesSelector() to match a selector, and if this fails, it falls back to the Sizzle selector logic.  The problem is that the webKitMatchesSelector is OS aware and thus removes focus from an element when the browser does not have focus, whereas Sizzle is unaware of the browser&amp;#8217;s focus status and thus matches successfully using the following code:&lt;/p&gt;
&lt;pre class="prettyprint"&gt;function( elem ) {
  return elem === elem.ownerDocument.activeElement;
}
&lt;/pre&gt;
&lt;p&gt;So to fix this problem, I have written a small Javascript file which you should include when you are running a test or cucumber Rails environment.  This script will then deactivate the native matches selector and query selector for your browser.&lt;/p&gt;
&lt;p&gt;The code to fix the &lt;strong&gt;:focus&lt;/strong&gt; issue can be found at &lt;a href="https://gist.github.com/1166821"&gt;&lt;a href="https://gist.github.com/1166821"&gt;https://gist.github.com/1166821&lt;/a&gt;&lt;/a&gt; and simply does the following:&lt;/p&gt;
&lt;pre class="prettyprint"&gt;/* Prevent use of native find selector */
document.querySelectorAll = false;

/* Prevent use of native matches selector */
document.documentElement.matchesSelector = false;
document.documentElement.mozMatchesSelector = false;
document.documentElement.webkitMatchesSelector = false;
document.documentElement.msMatchesSelector = false;
&lt;/pre&gt;
&lt;p&gt;If you would like to replicate this issue, review &lt;a href="https://gist.github.com/1155353/9ff3736f6d281bb9b784535527de4e33962d013c"&gt;this Gist&lt;/a&gt;.  An example set of tests where the issue is resolved can be seen in &lt;a href="https://gist.github.com/1166816/cad742e72e114e32cf0d3ffe80f447e5dce8f73a"&gt;this Gist&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I hope others find this useful.&lt;/p&gt;</description><link>http://blog.mattheworiordan.com/post/9308775285</link><guid>http://blog.mattheworiordan.com/post/9308775285</guid><pubDate>Tue, 23 Aug 2011 23:37:00 +0100</pubDate></item><item><title>Cucumber and Capybara-Webkit automatic screenshots</title><description>&lt;hr&gt;&lt;p&gt;&lt;strong&gt;This post has been superseded by a Gem I have written to do automatic screen shots for Capybara (not just Cucumber, also supports RSpec and Mini-test).  Please go to &lt;/strong&gt;&lt;strong&gt;&lt;a href="https://github.com/mattheworiordan/capybara-screenshot"&gt;&lt;a href="https://github.com/mattheworiordan/capybara-screenshot"&gt;https://github.com/mattheworiordan/capybara-screenshot&lt;/a&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;hr&gt;&lt;p&gt;&lt;strong&gt;&lt;br/&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Writing Cucumber front end tests (AJAX &amp;amp; Javascript) can be pretty damned painful and slow, especially when a failure does not come with any useful error message.  Fortunately I&amp;#8217;ve been using &lt;a href="https://github.com/thoughtbot/capybara-webkit"&gt;Capybara-Webkit&lt;/a&gt; recently, which brings two very useful features for debugging issues:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Javascript console messages (console.log) are sent directly to the shell whilst running your tests.  So you can effectively add debugging statements in your Javascript that are sent through to your terminal.  See below.&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_lq6d4f5vB51qargzy.png"/&gt; &lt;/li&gt;
&lt;li&gt;Capybara allows you to save out PNG screenshots from the current page.  So I&amp;#8217;ve written two convenient pieces of code that you may find useful.  
&lt;p&gt;The first one allows you to write &amp;#8220;Then take a snapshot&amp;#8221; or &amp;#8220;Then take a snapshot and show me the page&amp;#8221; within your features, and a PNG and HTML file will be saved into tmp/capyabara.&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;And insert this into your shared_steps.rb (if you have one) under /features/step_definitions &lt;/strong&gt;&lt;/p&gt;
&lt;pre class="prettyprint"&gt;Then /take a snapshot(| and show me the page)/ do |show_me|
  page.driver.render Rails.root.join("tmp/capybara/#{Time.now.strftime('%Y-%m-%d-%H-%M-%S')}.png")
  Then %{show me the page} if show_me.present?
end
&lt;/pre&gt;
&lt;p&gt;The second one ensures that whenever a scenario fails, a screen shot and HTML version of the page is saved into tmp/capybara automatically.&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Place this in your /features/support folder&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="prettyprint"&gt;def screen_shot_and_save_page
  require 'capybara/util/save_and_open_page'
  path = "/#{Time.now.strftime('%Y-%m-%d-%H-%M-%S')}"
  Capybara.save_page body, "#{path}.html"
  page.driver.render Rails.root.join "#{Capybara.save_and_open_page_path}" "#{path}.png"
end

begin
  After do |scenario|
    screen_shot_and_save_page if scenario.failed?
  end
rescue Exception =&amp;gt; e
  puts "Snapshots not available for this environment.\n
    Have you got gem 'capybara-webkit' in your Gemfile and have you enabled the javascript driver?"
end
&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;This code is up on a &lt;a href="https://gist.github.com/1156691"&gt;Gist at Github&lt;/a&gt; at so feel free to fork away.&lt;/p&gt;</description><link>http://blog.mattheworiordan.com/post/9120359890</link><guid>http://blog.mattheworiordan.com/post/9120359890</guid><pubDate>Fri, 19 Aug 2011 13:34:00 +0100</pubDate></item><item><title>Rate limiting Javascript requests</title><description>&lt;p&gt;I recently needed to rate limit requests to a particular function in Javascript, and was surprised nothing obvious came up in Google searches so here is my contribution for others who need this.&lt;/p&gt;
&lt;p&gt;Note that I am a big fan of &lt;a href="http://documentcloud.github.com/underscore/"&gt;Underscore.js&lt;/a&gt; and have thus simply extended the _ to include my new rate limiting function.  Also, many people immediately think that &lt;a href="http://documentcloud.github.com/underscore/#throttle"&gt;_.throttle&lt;/a&gt; will achieve rate limiting, but in fact _.throttle is a destructive rate limiting function in that it will disregard all requests that arrive within the time threshold specified.  If therefore you want to ensure that all calls are still executed, but are never executed more than once ever X milliseconds, then I suggest you use my method.&lt;/p&gt;
&lt;p&gt;The code is uploaded to a Gist which you can fork at &lt;a href="https://gist.github.com/1084831"&gt;&lt;a href="https://gist.github.com/1084831"&gt;https://gist.github.com/1084831&lt;/a&gt;&lt;/a&gt;, and is embedded below.&lt;/p&gt;
&lt;p&gt;&lt;span&gt; &lt;/span&gt;&lt;/p&gt;
&lt;pre class="prettyprint"&gt;// Rate limit ensures a function is never called more than every [rate]ms
// Unlike underscore's _.throttle function, function calls are queued so that
//   requests are never lost and simply deferred until some other time
//
// Parameters
// * func - function to rate limit
// * rate - minimum time to wait between function calls
// * async - if async is true, we won't wait (rate) for the function to complete
//           before queueing the next request
// 
// Example 
// function showStatus(i) { 
//   console.log(i); 
// } 
// var showStatusRateLimited = _.rateLimit(showStatus, 200); 
// for (var i = 0; i &amp;lt; 10; i++) { 
//   showStatusRateLimited(i); 
// } 
// 
// Dependencies 
// * underscore.js 
// 
_.rateLimit = function(func, rate, async) {
   var queue = [];
   var timeOutRef = false;
   var currentlyEmptyingQueue = false;
   
   var emptyQueue = function() {
     if (queue.length) {
       currentlyEmptyingQueue = true;
       _.delay(function() {
         if (async) {
           _.defer(function() { queue.shift().call(); });
         } else {
           queue.shift().call();
         }
         emptyQueue();
       }, rate);
     } else {
       currentlyEmptyingQueue = false;
     }
   };
   
   return function() {
     // get arguments into an array
     var args = _.map(arguments, function(e) { return e; });
     // call apply so we can pass in arguments as parameters as opposed to an array
     queue.push( _.bind.apply(this, [func, this].concat(args)) );
     if (!currentlyEmptyingQueue) { emptyQueue(); }
   };
};
&lt;/pre&gt;
&lt;p&gt;You can see a working version at &lt;a href="http://jsbin.com/upadif/8/edit#preview"&gt;&lt;a href="http://jsbin.com/upadif/8/edit#preview"&gt;http://jsbin.com/upadif/8/edit#preview&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.mattheworiordan.com/post/8084693270</link><guid>http://blog.mattheworiordan.com/post/8084693270</guid><pubDate>Tue, 26 Jul 2011 14:30:00 +0100</pubDate></item><item><title>Full stack integration testing with Rails 3, Cucumber, RSpec, QUnit and Capybara</title><description>&lt;p&gt;I find it enlightening to be part of such an active &lt;a href="http://www.ruby-lang.org/"&gt;Ruby&lt;/a&gt; and &lt;a href="http://rubyonrails.org/"&gt;RoR&lt;/a&gt; community where Gems, code samples and responsive community support is available, however I also find it hard sometimes for that very same reason to figure out what stack to use for my new projects because there are just too many options.&lt;/p&gt;
&lt;p&gt;One of the problems I&amp;#8217;ve had for a while now is figuring out what stack to use for my testing, both for my back end code (unit &amp;amp; integration) as well as my front end code (unit &amp;amp; integration).  So this blog post is about my journey in April 2011 to find the best full stack integration components for a Rails project and document it for others to use.  I hope others find this useful.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Background&lt;/strong&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I use RSpec and Cucumber for all my testing, but my application&amp;#8217;s front end is becoming increasingly complex and needs testing as well.  I would ideally like a combination of both unit testing and integration testing on the Javascript and front end elements.  And I want my tests to be as fast as possible because the longer it takes the less likely it is I&amp;#8217;ll run them.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;The objective of this exercise&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Document the entire process collecting all useful resources together in one place so others can learn from this&lt;/li&gt;
&lt;li&gt;Set up a &lt;a href="https://github.com/mattheworiordan/Full-stack-testing"&gt;basic Rails 3 project and push it to Github&lt;/a&gt; which has enough back end &amp;amp; front end code to write some meaningful tests.  This must include some asynchronous client-server requests.  And a Javascript framework such as jQuery should be used to make the stack and environment realistic.&lt;/li&gt;
&lt;li&gt;Write RSpec &amp;amp; Cucumber tests for traditional unit testing and integration testing.&lt;/li&gt;
&lt;li&gt;Explore options to unit test and integration test the front end code, documenting the pros &amp;amp; cons for each&lt;/li&gt;
&lt;li&gt;Find the best stack for me and put that up on Github for others to use&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;My journey to find the ideal full stack integration suite for Rails 3 (as of now)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I installed a clean version of Rails 3.0.3 on Ruby 1.9.2.  &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/commit/995efcdd00d2f994f916dbac502e7f2b36de5271"&gt;See commit&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I like to use RSpec for all unit tests, so I installed RSpec and removed all the old Test::Unit files in /test/.  &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/commit/ddea5db2f4610f1113d53e291eb76b34fa882751"&gt;See commit&lt;/a&gt;.  After you &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/commit/ddea5db2f4610f1113d53e291eb76b34fa882751#diff-2"&gt;add the gems to your Gemfile&lt;/a&gt;, remember run `bundle` and also to run the RSpec generator `script/rails generate rspec:install`.  For those of you that use scaffolding (I avoid it), I also &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/commit/ddea5db2f4610f1113d53e291eb76b34fa882751#diff-4"&gt;modified config/application.rb&lt;/a&gt; to instruct Rails 3’s generators to always use RSpec rather than Test::Unit. &lt;/p&gt;
&lt;p&gt;My favourite tool for integration testing is &lt;a href="http://cukes.info/"&gt;Cucumber&lt;/a&gt;.  RSpec can be used for integration testing too, and I know there is a current view from DHH himself that both &lt;a href="http://www.rubyinside.com/dhh-offended-by-rspec-debate-4610.html"&gt;RSpec and Cucumber are unnecessary&lt;/a&gt;, however I like Cucumber and the readable user stories are great.  So I went ahead and installed Cucumber that by default now uses &lt;a href="https://github.com/jnicklas/capybara"&gt;Capybara&lt;/a&gt; (it used to default to &lt;a href="https://github.com/brynary/webrat"&gt;Webrat&lt;/a&gt;).  I followed the &lt;a href="https://github.com/cucumber/cucumber/wiki/Ruby-on-Rails"&gt;Cucumber Rails installation instructions&lt;/a&gt;, however to ensure Capybara is used for tests as opposed to Webrat I ran the following generator command `rails generate cucumber:install &amp;#8212;capybara`.  &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/commit/ab8dc8ddd494ce380f44b7d7f88ab445ec2bd87b"&gt;See commit.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In order to get the project ready for front end development, I cleared out the index.html file, installed a copy of &lt;a href="http://jquery.com/"&gt;jQuery&lt;/a&gt; and &lt;a href="https://github.com/rails/jquery-ujs"&gt;RoR JQuery UJS&lt;/a&gt;, removed all javascript files and added the &lt;a href="https://github.com/rails/jquery-ujs/blob/master/src/rails.js"&gt;UJS Javascript file&lt;/a&gt;), and added in a stripped down jQuery UI code base to allow for some more complex user interactions.  &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/commit/ba5eb594aa08cc979557dd76f598a2f75166e5b1"&gt;See commit&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I then went ahead and installed &lt;a href="http://sass-lang.com/"&gt;SASS&lt;/a&gt; because writing traditional CSS just sucks.  I normally use &lt;a href="http://haml-lang.com/"&gt;HAML&lt;/a&gt; as well instead of ERB, but for the purposes of this example I thought it best to keep things as understandable as possible and it&amp;#8217;s quite possible HAML is less understood (and once again, &lt;a href="http://www.rubyinside.com/rails-3-1-adopts-coffeescript-jquery-sass-and-controversy-4669.html"&gt;DHH does not like it&lt;/a&gt;). &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/commit/08b4b76cd2d6eebce3f0ed41a173c9cf3d642309"&gt;See commit&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Building the Calculator app and tests&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Following good TDD, I then went ahead and wrote the tests for a new Calculator model class that I am about to build.  The calculator is intentionally very simple and only supports addition, subtraction, multiplication and division.  I kept the tests simple and adequate for the purposes of this project.  I then ran RSpec `&lt;em&gt;rspec spec/models/*.rb&lt;/em&gt;` and got a load of errors as the Calculator class does not yet exist.  &lt;/p&gt;
&lt;p&gt;In order to satisfy the tests, I built a simple Calculator class that lives in the /app/models/ directory.  I ran RSpec until everything was green, and voila, we now have a test suite for the model which passes.  &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/commit/b0182650d3c452a3e173d2cdb20811e53efd13d2"&gt;See commit&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_ljranpFdZV1qargzy.png"/&gt;&lt;/p&gt;
&lt;p&gt;I then built a very simple HTML based calculator and a controller called Calculator to manage all calculator operations.  &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/commit/5017114463c7cca7b79435f6401e67ba79f06d4e"&gt;See commit&lt;/a&gt;.  I pushed it up online using Heroku and posted it at &lt;a href="http://full-stack-testing.heroku.com/calculator"&gt;&lt;a href="http://full-stack-testing.heroku.com/calculator"&gt;http://full-stack-testing.heroku.com/calculator&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Once finished, I added some Cucumber integration tests which will run using Capybara&amp;#8217;s default driver rack_test as they do not need Javascript support.  Ideally I should have written the features first, but for the purposes of this example I was very much discovering as I built, and had no spec to work from.  Fortunately in most traditional situations I have a spec I can work from and can therefore follow &lt;a href="http://en.wikipedia.org/wiki/Test-driven_development"&gt;TDD&lt;/a&gt; and build out the Cucumber features first.&lt;/p&gt;
&lt;p&gt;The first test was extremely simple as follows:&lt;/p&gt;
&lt;script src="https://gist.github.com/923298.js?file=calculator.feature"&gt;&lt;/script&gt;&lt;p&gt;I ran `rake cucumber` and ran into the following issues:&lt;/p&gt;
&lt;p&gt;Firstly I received the error:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;schema.rb doesn&amp;#8217;t exist yet. Run &amp;#8220;rake db:migrate&amp;#8221; to create it then try again. If you do not intend to use a database, you should instead alter /Users/matthew/Projects/full_stack_integration_testing/config/application.rb to limit the frameworks that will be loaded&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;To fix that I simply ran rake db:migrate which created an empty schema.rb file.&lt;/p&gt;
&lt;p&gt;I then re-ran `rake db:migrate` and ran `rake cucumber` again.  Unfortunately this time I received a rather less intuitive error:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;undefined local variable or method `node&amp;#8217; for #&amp;lt;Capybara::Driver::Node tag=&amp;#8221;a&amp;#8221; path=&amp;#8221;/html/body/a&amp;#8221;&amp;gt; (NameError)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;After a little searching it seems this is a known error.  I found this strange considering I thought I was on the latest stable versions of all gems, and my feature is extremely simple.  However, after looking at &lt;a href="https://github.com/jnicklas/capybara/issues/235"&gt;a related closed issue in Capybara&lt;/a&gt; I see that this &lt;a href="https://github.com/jnicklas/capybara/issues/156"&gt;issue was corrected&lt;/a&gt;, so I clearly don&amp;#8217;t have the latest gems.  I had to modify my Gemfile to explicitly request cucumber-rails with a version greater than or equal to 0.4.0 to replace the 0.3.2 version that we was used by default.&lt;/p&gt;
&lt;p&gt;I then re-ran `rake cucumber` and unfortunately hit another error as described at &lt;a href="http://blog.firsthand.ca/2011/02/cucumber-rails-undefined-local-variable.html"&gt;&lt;a href="http://blog.firsthand.ca/2011/02/cucumber-rails-undefined-local-variable.html"&gt;http://blog.firsthand.ca/2011/02/cucumber-rails-undefined-local-variable.html&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I had to re-run `rails g cucumber:install` to regenerate the cucumber files, and then I was ready to run rake cucumber again.  &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/commit/08ec2935c083e77bf293dc5ee5eacd7ee75d2bc4"&gt;See commit&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;So I finally ran `rake cucumber` and fortunately my very simple test passed as follows:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_ljt5yood3l1qargzy.png"/&gt;&lt;/p&gt;
&lt;p&gt;So I went on to writing some more expansive Cucumber scenarios to provide better integration testing of the calculator.  And after building only &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/commit/a6f4c15a4cae437e7f2be0c7df2a944a3f605b28#diff-2"&gt;one additional step&lt;/a&gt;, I managed to create a Cucumber feature which covered the bulk of the functionality offered including exceptions for the Calculator.  &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/commit/a6f4c15a4cae437e7f2be0c7df2a944a3f605b28"&gt;See commit&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Test performance and Spork&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;So a recurring problem I have is that whilst Cucumber tests report completing quite quickly (in around 2.5s in this case), it took considerably longer than that in reality as the rails environment start up time is very slow.  Whilst I appreciate testing is an absolute necessity, if it&amp;#8217;s going to be painfully then that&amp;#8217;s going inevitably deter me from testing.  So I have heard about spork on a few of the podcasts I follow, and understand that spork is effectively a library which runs your test suite by forking a new copy of the Rails environment each time you run your tests.  So I went ahead and followed the &lt;a href="https://github.com/timcharper/spork"&gt;Spork installation instructions&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Specifically I added the following lines to my Gemfile&lt;/p&gt;
&lt;script src="https://gist.github.com/923298.js?file=Gemfile"&gt;&lt;/script&gt;&lt;p&gt;I then ran `spork &amp;#8212;bootstrap` which modified the file spec/spec_helper.rb and added further installation instructions into that file.  I looked through the instructions and read that out of the box spork works well with rails.  So I left all settings as they were.&lt;/p&gt;
&lt;p&gt;I then started up the spork server by simply running `spork` and got the following:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_ljtdejK8CQ1qargzy.png"/&gt;&lt;/p&gt;
&lt;p&gt;I then ran my first set of RSpec tests with `rspec &amp;#8212;drb spec/**/*` and it was damn quick.  Everything was completed in under a second, amazing.&lt;/p&gt;
&lt;p&gt;So I then read that to run the cucumber tests using spork all I needed was to run `script/cucumber &amp;#8212;drb` so I went ahead and did that but unfortunately was not quite so lucky.  I got the response:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;  WARNING: No DRb server is running. Running features locally:&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;So I did a bit of searching and found an article on &lt;a href="https://github.com/aslakhellesoy/cucumber/wiki/Spork-and---drb"&gt;using spork with DRB on the cucumber Wiki&lt;/a&gt;.  It turns out I need to run the generator again and include spork support.  As I need capybara support too (see above), I ran the following:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;rails generate cucumber:install &amp;#8212;capybara &amp;#8212;spork&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;It asked to overwrite my paths file, so I let it do that and just reinserted the custom path I had added earlier.&lt;/p&gt;
&lt;p&gt;I then ran `script/cucumber &amp;#8212;drb&amp;#8217; and was told again:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;WARNING: No DRb server is running. Running features locally:&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I did a bit of searching and discovered that this was because the spork DRB server was actually running for use with RSpec and it needs to be run for use with Cucumber.  So I stopped the spork server and executed the spork server for cucumber as follows `spork cuc`&lt;/p&gt;
&lt;p&gt;I then run `script/cucumber &amp;#8212;drb&amp;#8217; and as expected the test ran immediately, considerably quicker than before.&lt;/p&gt;
&lt;p&gt;As I want to run both Cucumber tests and RSpec tests as fast as possible, I wanted to find out how I can run spork for both cucumber an RSpec simultaneously.  It turns out this is quite simple, all I need to do is run the following command:&lt;br/&gt;`bundle exec spork cucumber &amp;amp; bundle exec spork rspec &amp;amp;`&lt;br/&gt;which gets spork for cucumber and rspec running as background tasks, and on different ports namely 8989 for RSpec and 8990 for Cucumber.  Note you can access these tasks using `jobs`, or `fg [job number]`.  You can also kill these tasks using `kill %[job number]`&lt;/p&gt;
&lt;p&gt;Spork for both environments is something I&amp;#8217;m going to use often, so I set up a simple script &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/blob/master/script/spork"&gt;script/spork&lt;/a&gt; which runs spork in the background for both RSpec and Cucumber.  To make this an executable I ran the command chmod 777 script/spork in the root.  I ran `script/spork` and both servers were started in the background.&lt;/p&gt;
&lt;p&gt;In order to measure performance improvement of the tests using spork, I set up a basic benchmarking script residing in scripts.  The code is extremely simple and runs the rspec tests and cucumber tests without DRB (that&amp;#8217;s what spork uses), and then with DRB to see the difference.  I noticed however that cucumber.yml was configured to run &amp;#8212;drb as an option automatically, so I removed this and added -c for colour output.  I then ran script/benchmark_tests and got the following results:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;RSpec without spork took: 9.81s&lt;/li&gt;
&lt;li&gt;RSpec with spork (DRB) took: 1.11s&lt;br/&gt;Spork saved 8.70s when running RSpec tests&lt;/li&gt;
&lt;li&gt;Cucumber without spork took: 13.69s&lt;/li&gt;
&lt;li&gt;Cucumber with spork (DRB) took: 4.31s&lt;br/&gt;Spork saved 9.38s when running Cucumber tests&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;So it looks like spork is doing a great job in saving on the start up time of the tests for both Cucumber and RSpec.  Admittedly as my tests increase in size this start up time saving will become less relevant, but any speed improvement is welcome especially when running RSpec unit tests which are typically quite fast.  &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/commit/226d277ce3fc2e6a6ce97df06b5c733a60347b7f"&gt;See commit&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Automated tests and Watchr&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;And this is all great, but I don&amp;#8217;t really like jumping into the console every time I need to run a test.  What I want is to run tests automatically whenever I change the relevant files in my project.  I&amp;#8217;ve heard of two apps which achieve this, autotest and watchr.  Watchr seems to be gaining more traction of late, and my previous experience with autotest has not been brilliant and have always had problems getting it running reliably.  So without much further research, I decided to use Watchr quite simply because influential Rubyists have been talking about it recently so I trust their judgement.  So firstly I added watchr gem to my Gemfile and ran `bundle`&lt;/p&gt;
&lt;p&gt;I then found a &lt;a href="https://gist.github.com/737560/d766c91c8bcad3c00c94cbea99a43f272e8ca64a%20"&gt;Gist&lt;/a&gt; which seems to roughly achieve what I want in that it supports DRB, Cucumber and RSpec.  I saved the Gist source code to script/watchr.rb and I tried running `watchr script/watchr.rb` but unfortunately was told that Growl was not installed.  I added growl to the Gemfile, ran `bundle` and then reran `watchr script/watchr.rb` and it started up as expected.  However, when changing an RSpec file in spec/models the tests did not run as expected, so I made a few changes to watchr.rb.  Please take a look at &lt;a href="https://gist.github.com/900039"&gt;my Gist&lt;/a&gt; to see the list of changes.&lt;/p&gt;
&lt;p&gt;So once I made my changes, everything seemed to be working except that the growl notifications did not have an image displaying, and the output from RSpec was not colour coded.  So firstly to address the Growl issue I downloaded some &lt;a href="http://thelucid.com/category/rake/"&gt;PNG status icons&lt;/a&gt; and saved them into /script/.watchr_images.  In order to resolve the ANSI colors being lost for RSpec issue, I tried a number of alternatives using all methods described in the article &amp;#8220;&lt;a href="http://mentalized.net/journal/2010/03/08/5_ways_to_run_commands_from_ruby/"&gt;5 ways to run commands from ruby&lt;/a&gt;&amp;#8220; but unfortunately none of those solutions worked.  So I &lt;a href="http://stackoverflow.com/questions/5526842/ruby-popen3-and-ansi-colour"&gt;posted a question on Stackoverflow&lt;/a&gt;  and someone helped me find the solution.  In order to have colour show up in RSpec you need to tell it you are outputting to tty so that colour is supported, so I modified the $spec_cmd in watchr.rb to the following:&lt;/p&gt;
&lt;p&gt;Now any changes to features will trigger Cucumber, and any changes to models or unit tests will trigger RSpec and confine to the effected files where possible.  &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/commit/de9e23e7d92fd1d109d4568a6ee76a2ea9ddfa59"&gt;See commit&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Front end unit and integration testing&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;So onto the more difficult parts, front end unit and integration testing.  So I have gone ahead and &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/commit/a30ff43f0c04fac2c0ee8fbe73efc38301c14694"&gt;added some trivial front end code&lt;/a&gt; to the calculator which presents a set of buttons for the calculator so users don&amp;#8217;t have to use the text field when entering the number used in operations.  I wanted to ensure that my tests had some AJAX functionality too as this is generally needed in my web applications.  So in summary, the code I added provides us with the following to be tested:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Simple Javascript class methods that can be unit tested i.e. no DOM is required&lt;/li&gt;
&lt;li&gt;DOM manipulation on load to add additional features to the calculator&lt;/li&gt;
&lt;li&gt;AJAX communication with a server and dynamic updating of the DOM including handling of errors&lt;/li&gt;
&lt;li&gt;Prompt dialog box which requires the user to interact with to continue when performing an operation on zero&lt;/li&gt;
&lt;li&gt;Alert dialog box which prevents a user from dividing by zero&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jqueryui.com/"&gt;JQuery UI&lt;/a&gt; Dialog box which again needs user to interact with to continue&lt;/li&gt;
&lt;li&gt;Drag &amp;amp; drop functionality (you can drag values from the calculator to a pretty pointless memory bank)&lt;/li&gt;
&lt;li&gt;Use of persistent cookies to persist the values stored in the memory bank&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;I &lt;a href="http://committed%20all%20those%20changes"&gt;committed all those changes&lt;/a&gt; and you can see the calculator live at &lt;a href="http://full-stack-testing.heroku.com/calculator"&gt;&lt;a href="http://full-stack-testing.heroku.com/calculator"&gt;http://full-stack-testing.heroku.com/calculator&lt;/a&gt;&lt;/a&gt;.  Please note that the calculator is not particularly intuitive so you need to enter the value first and then press the operation you wish to use! This was done so that most operations can be performed using simple HTML forms.&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;&lt;strong&gt;My search for the best front end testing libraries&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The first library I found was the &lt;a href="https://github.com/mynyml/harmony"&gt;Harmony gem&lt;/a&gt;.  Harmony uses &lt;a href="https://github.com/jbarnette/johnson"&gt;Johnson&lt;/a&gt; to access the Mozilla Spidermonkey Javascript engine developed for Firefox.  Harmony then uses &lt;a href="http://www.envjs.com/"&gt;env.js&lt;/a&gt; to simulate a browser DOM.  Now if we&amp;#8217;re just going to be doing unit tests at first, then arguably we don&amp;#8217;t need a DOM, however considering most of the JavaScript relies on jQuery and in turn the DOM, I think it&amp;#8217;s wise to ensure there is support for a DOM and thus we won&amp;#8217;t need to mock or stub too much code to get the unit tests running.  I also came across &lt;a href="https://github.com/mynyml/holygrai"&gt;Holygrail&lt;/a&gt; which is a Harmony plugin specifically for Ruby on Rails.  I added the following gems to my Gemfile:&lt;/p&gt;
&lt;script src="https://gist.github.com/923298.js?file=Gemfile"&gt;&lt;/script&gt;&lt;p&gt;I then run `bundle` but unfortunately I ran into issues installing Johnson.  Looking through the errors (and there were loads), they were all related to the C build of this so not something I wanted to try and dig into and solve.  I then took a look at the last commit dates for Johnson and it was worrying, March 2010, so over a year since anything was contributed.  I did the same for Harmony and the last update was July 2010, so again, closing in on a year since the last update.  I also found some posts indicating that Johnson does not support Ruby 1.9.2 which is the version of Ruby I am using.  Encouragingly env.js was updated days ago, so that project is still very active.  So I abandoned the Johnson / Harmony option and looked for a testing framework that has a more active community and was still being developed.&lt;/p&gt;
&lt;p&gt;I found &lt;a href="https://github.com/cowboyd/therubyracer"&gt;RubyRacer&lt;/a&gt; which is constantly being updated and arguably uses the best available Javascript engine as it uses Googles V8.  Unfortunately I could not find any examples where The Ruby Racer had been used for RSpec or Cucumber testing other than a few discussions on the matter, some experiments and some basic examples:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="https://rspec.lighthouseapp.com/projects/16211/tickets/595-support-javascript-through-johnson"&gt;Looks like Joseph Wilk has the right idea, but no activity since Sep 2010&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/aslakhellesoy/cucumber/tree/master/examples/v8"&gt;Looks like Cucumber can run tests with the V8 engine&lt;/a&gt;, but not sure this is quite what we are after.  Also, I am looking to do Javascript Rspec testing too which this does not address.&lt;/li&gt;
&lt;li&gt;I came &lt;a href="http://groups.google.com/group/jasmine-js/browse_thread/thread/7476b36ccc987099"&gt;across a discussion&lt;/a&gt; about &lt;a href="http://pivotal.github.com/jasmine/"&gt;Jasmine&lt;/a&gt; being integrated with Ruby Racer which allowed testing at, however again it looks like incomplete and not really active anymore.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;So after some further research, I found that RSpec itself supports Capybara as well as Webrat.  See the &lt;a href="http://railscasts.com/episodes/257-request-specs-and-capybara"&gt;RSpec and Capybara Railscast&lt;/a&gt; and the f&lt;a href="https://github.com/rspec/rspec-rails/commit/d4ff873441cad75e9dd6e7dd1dfccf532bb4febf"&gt;ollowing commit on RSpec Rails&lt;/a&gt;.  There are also some examples on the &lt;a href="https://github.com/jnicklas/capybara"&gt;Capybara Github home page&lt;/a&gt;.  So I set out to get Capybara running with Rails Rspec to see if we could get it to run an RSpec test.  The problem is that we need to decide which driver to use.  The common options are:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://seleniumhq.org/projects/ruby/"&gt;Selenium&lt;/a&gt; (launches and automates browser, brilliant but slow)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.envjs.com/"&gt;Envjs&lt;/a&gt; (after trying to install this gem and capaybara-envjs this there are numerous problems getting this working with Ruby 1.9.2, probably because it relies on Johnson which is not Ruby 1.9.2 compatible, see &lt;a href="http://groups.google.com/group/ruby-capybara/browse_thread/thread/1556c7a2b0fe0996"&gt;&lt;a href="http://groups.google.com/group/ruby-capybara/browse_thread/thread/1556c7a2b0fe0996"&gt;http://groups.google.com/group/ruby-capybara/browse_thread/thread/1556c7a2b0fe0996&lt;/a&gt;&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/jarib/celerity"&gt;Celerity&lt;/a&gt; (headless browser in Java, requires JRuby)&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/langalex/culerity"&gt;Culerity&lt;/a&gt; (headless browser that can be run from normal MRI ruby i.e. not JRuby, but does not appear to support Ruby 1.9.2 at present)&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/bernerdschaefer/akephalo"&gt;Akephalos&lt;/a&gt; which &lt;a href="http://robots.thoughtbot.com/post/1658763359/thoughtbot-and-the-holy-grail"&gt;according to Thoughtbot back in Nov 2010&lt;/a&gt; was the best option out there.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;New (as of 26 Jul 11): &lt;a href="https://github.com/thoughtbot/capybara-webkit"&gt;Capybara Webkit&lt;/a&gt; is the new kid on the block, and supports a full high performance Webkit headless browser.  Read at the bottom of the post for an update on how to get this working after following all the steps in this post.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;So I installed Capybara and tried to run an RSpec test placing it in the requests folder (which automatically invokes Capybara).  Unfortunately I wrote some tests which assume Javascript is running, but I could not get Capybara and Akephalos / Selenium to run with RSpec.  I am told that Capybara is being used, but it refuses to use a Javascript driver for some reason even with my RSpec tests metadata set as follows:&lt;/p&gt;
&lt;script src="https://gist.github.com/923298.js?file=basic_rspec_test.rb"&gt;&lt;/script&gt;&lt;p&gt;So eventually I decided to focus for now on Cucumber tests to ensure that Capybara is set up correctly to use Selenium and Akephalos first.  I wrote some basic tests with tags for @javascript and @selenium to test Javascript functionality.  In my cucumber env.rb file I added the following so that Akephalos is the default Javascript driver and Selenium can be used where necessary:&lt;/p&gt;
&lt;script src="https://gist.github.com/923298.js?file=env.rb"&gt;&lt;/script&gt;&lt;p&gt;And I ensured that the following gems were added to the Gemfile and bundle was executed:&lt;/p&gt;
&lt;script src="https://gist.github.com/923298.js?file=Gemfile_for_akephalos.rb"&gt;&lt;/script&gt;&lt;p&gt;Cucumber ran as expected, so the following two simple example tests passed and Firefox was instantiated for the test tagged with @selenium:&lt;/p&gt;
&lt;script src="https://gist.github.com/923298.js?file=calculator.feature"&gt;&lt;/script&gt;&lt;p&gt;So now that I knew that Capybara is working correctly, I wanted to get RSpec working with Capybara.  So instead of using RSpec metadata according to the &lt;a href="https://github.com/jnicklas/capybara"&gt;instructions on the Capybara page&lt;/a&gt; under the section &amp;#8220;Using Capybara with RSpec&amp;#8221;, I manually set the driver in the RSpec tests as follows:&lt;/p&gt;
&lt;script src="https://gist.github.com/923298.js?file=basic_test_javascript.rb"&gt;&lt;/script&gt;&lt;p&gt;And this worked.  So this led me to believe that for some reason RSpec is simply ignoring the metadata.  I did a bit of searching and found &lt;a href="https://github.com/jnicklas/capybara/pull/187"&gt;a ticket about Driver swapping with RSpec 2&lt;/a&gt; which pointed to a &lt;a href="https://gist.github.com/669072"&gt;useful Gist&lt;/a&gt;.  So I used the code form the Gist as a base and added the following to my spec_helper.rb file:&lt;/p&gt;
&lt;script src="https://gist.github.com/910216.js?file=spec_helper.rb"&gt;&lt;/script&gt;&lt;p&gt;With this configuration in place I was able to run the following two simple tests, the first using the default Javascript driver Akephalos, and the second using the driver Selenium as it is explicitly required.&lt;/p&gt;
&lt;script src="https://gist.github.com/923298.js?file=basic_rspec_test_with_2_drivers.rb"&gt;&lt;/script&gt;&lt;p&gt;However, when I ran the tests from under watchr using &amp;#8212;drb Akephalos failed with an error messages:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Failure/Error: within(&amp;#8220;#calculator&amp;#8221;) do&lt;br/&gt;  RangeError:&lt;br/&gt;     0x0000008184a6a8 is recycled object&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I found an &lt;a href="https://github.com/bernerdschaefer/akephalos/issues/60"&gt;open ticket&lt;/a&gt; created around a month ago describing this issue.  It seems that as both Cucumber and RSpec are failing Akephalos tests with spork, we&amp;#8217;re going to unfortunately need to disable Spork for now.  Whilst Spork helps speed up the start up time for tests, I have read it actually marginally slows down the tests themselves, and based on how long my test are taking to run now once we start up a headless browser and an actual browser, I don&amp;#8217;t think the start up time is that significant anymore.  &lt;del&gt;So until the spork and Akephalos issue is resolved,&lt;/del&gt; (see &lt;a href="http://spacevatican.org/2011/7/3/sporking-with-akephalos"&gt;&lt;a href="http://spacevatican.org/2011/7/3/sporking-with-akephalos"&gt;http://spacevatican.org/2011/7/3/sporking-with-akephalos&lt;/a&gt;&lt;/a&gt; for a workaround) I&amp;#8217;m going to opt for using watchr without spork.&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;&lt;strong&gt;Front end unit testing from Rails&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Whilst for this calculator app there is not a specific Javascript unit testing requirement, for the purposes of this article I wanted to work how I will be unit testing my front end code in future, and what&amp;#8217;s the best way for myself.  On one hand, I can simply insert Javascript code into my RSpec tests using code such as:&lt;/p&gt;
&lt;script src="https://gist.github.com/923298.js?file=single_test.rb"&gt;&lt;/script&gt;&lt;p&gt;however that doesn&amp;#8217;t feel quite right to me.  Firstly, if the Javascript test code got complex I&amp;#8217;d have lots of Javascript code embedded in my Ruby code which is just messy and hard to debug.  Also, I feel like I&amp;#8217;d like a solution where the tests could also be run in my browser so that whilst developing my front end code I could manually initiate tests without having to invoke RSpec each time.  I know there are lots of Javascript testing frameworks out there, but the one I hear of most often (and is used by the JQuery team) is &lt;a href="http://docs.jquery.com/Qunit"&gt;QUnit&lt;/a&gt;.  I also came across this &lt;a href="https://github.com/mkrisher/qunit_for_rails"&gt;QUnit plugin for Rails&lt;/a&gt;, however it&amp;#8217;s very out of date (last update Dec 2009) so I expect no longer relevant.  I then looked at &lt;a href="http://code.google.com/p/js-test-driver/"&gt;JsTestDriver&lt;/a&gt; which allows you to have multiple browsers running as slaves and simultaneously run tests against all those browsers.  Whilst this sounds useful, I don&amp;#8217;t want to overcomplicate what I&amp;#8217;m trying to achieve at this stage, so I decided to stick with QUnit for this article.&lt;/p&gt;
&lt;p&gt;So first thing I did was download and add qunit.js and qunit.css to my project.  I then wanted to keep my QUnit tests in the specs folder along with all my other tests files, but this was not possible out of the box as those files are not accessible from the browser.  So I set up a simple route and controller for my Javascript tests which serves up the Javascript tests using a special QUnit HTML template I set up.  The controller is simply:&lt;/p&gt;
&lt;script src="https://gist.github.com/923298.js?file=javascript_test_controller.rb"&gt;&lt;/script&gt;&lt;p&gt;Note that I store all my javascript test in &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/tree/master/spec/javascript"&gt;/spec/javascript/&lt;/a&gt; and suffix them all with _spec.js.erb.  And I have also forbidden the running of these tests unless in test or development environments.&lt;/p&gt;
&lt;p&gt;I then added a route:&lt;/p&gt;
&lt;script src="https://gist.github.com/924517.js?file=route.rb"&gt;&lt;/script&gt;&lt;p&gt;And added a simple HTML template &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/blob/master/app/views/layouts/javascript_test.js.erb"&gt;javascript_test.js.erb&lt;/a&gt; into layouts for use with QUnit tests.&lt;/p&gt;
&lt;p&gt;I then &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/commit/820dba6da7130972fd5426d3094e523ddfd6159b#diff-5"&gt;modified my calculator.js&lt;/a&gt; class to be a bit more testable for the purposes of Unit tests (i.e. removed dependency on the DOM for various methods including the AJAX functions), and set up my first set of tests in a new file I named &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/blob/master/spec/javascript/calculator_spec.js.erb"&gt;calculator_spec.js.erb&lt;/a&gt;.  Here is an excerpt from the spec file which shows a normal Unit test as well as one which supports asynchronous AJAX requests:&lt;/p&gt;
&lt;script src="https://gist.github.com/924517.js?file=qunit_test.js"&gt;&lt;/script&gt;&lt;p&gt;So I now have QUnit running nicely in my browser when I visit http://localhost:3000/javascript_test/calculator on my dev machine.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_ljthfa7hoE1qargzy.png"/&gt;&lt;/p&gt;
&lt;p&gt;However what I really want is for these QUnit tests to be run automatically as part of my RSpec tests.  My rationale for this is that all my unit tests are run from RSpec whilst all integration tests are run from Cucumber.  So I don&amp;#8217;t want to now have to manually run QUnit tests as well, I want these tests to be run automatically whenever Watchr picks up changes or RSpec is invoked manually.&lt;/p&gt;
&lt;p&gt;So I wrote a &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/blob/master/spec/javascript/runner.rb"&gt;new RSpec test&lt;/a&gt; which simply iterates through the tests in the /spec/javascript folder, invokes the Akephalos headless browser, and renders the HTML and Javascript for the page.  It then sleeps until the QUnit tests have completed (with a 60 second limit per suite of tests), and once the tests have completed it checks that each QUnit test passed using Nokogiri which parses the HTML.  As QUnit generates an HTML based microformat it&amp;#8217;s easy to iterate through each passed/failed test.  As you can see in my &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/commit/c772b879d6f2dd6a090e3c4610aa5a05ec8f8aa3#diff-4"&gt;commit&lt;/a&gt;, test 5 &amp;#8220;Wait up to 5 seconds but fail with timeout after 3.5 seconds&amp;#8221; fails as expected, whereas all the other tests pass.  To ensure the Javascript tests run automatically, I &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/commit/c772b879d6f2dd6a090e3c4610aa5a05ec8f8aa3#diff-3"&gt;modified watchr&lt;/a&gt; to include the Javascript tests too.  See &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/commit/36d608b0f897e0ce19979326e3c8c5d04bd4f720"&gt;corrected commit here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;&lt;strong&gt;More complex user interactions for the Cucumber integration tests&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The last thing I want to do now is have some more complex integration test examples working so that we can simulate a more extensive set of user interactions.  Our calculator already supports some more complex interactions as follows:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Drag and drop - you can drag the calculator current value into the history area&lt;/li&gt;
&lt;li&gt;Use of cookies - a user&amp;#8217;s history of drag and drop should be retained across sessions&lt;/li&gt;
&lt;li&gt;Handle a confirm dialog box which requires user input to continue - I have added a confirm when performing an operation on a zero value.&lt;/li&gt;
&lt;li&gt;Handle an alert dialog box which should appear when dividing by zero.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Confirm &lt;a href="http://code.google.com/p/selenium/wiki/RubyBindings#Javascript_Alert/Confirm"&gt;dialog boxes are supported natively by Ruby Selenium Webdriver&lt;/a&gt;, however this method only works with Firefox and would also then fail for any Akephalos tests.  My feeling is that unless Capybara has a generic way of dealing with alert / confirm dialog boxes, then it would be better to stub out this functionality using Javascript.  I found a an article on this, &amp;#8220;&lt;a href="http://stackoverflow.com/questions/2458632/how-to-test-a-confirm-dialog-with-cucumber"&gt;How to test a confirm dialog with Cucumber&lt;/a&gt;&amp;#8221; which led me to the &lt;a href="https://gist.github.com/727614"&gt;this Gist&lt;/a&gt; which I &lt;a href="https://gist.github.com/919116"&gt;forked to support confirm &amp;amp; alert dialog tests with cucumber&lt;/a&gt;.  &lt;/p&gt;
&lt;p&gt;So I got confirmation and alert dialog boxes working, along with drag and drop testing in &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/commit/53224b9cffb7cf35ab382ef2e59a295207be7f93"&gt;this commit&lt;/a&gt;.  It was worth noting that Akephalos &amp;amp; HTMLUnit failed the drag and drop test in that no error was raised when calling drag_to, however I found the drag &amp;amp; drop event was never fired for some reason.  So in order to get all my features passing I have used Selenium for the drag &amp;amp; drop tests, and Akephalos for all other tests.&lt;/p&gt;
&lt;p&gt;Finally, I realised that although my application has no database, most applications would so I needed to configure RSpec2 to not use transactional fixtures when running Javascript tests.  &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/commit/c8f7909ad5e7e0c2893f13e4afeb896f87c8c24a"&gt;See commit&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Updates to this post as of 26 July 2011 - Capybara Webkit&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Since I wrote this article, the great folk over at Thoughtbot have indeed come up with a solution called &lt;a href="https://github.com/thoughtbot/capybara-webkit"&gt;Capybara-Webkit&lt;/a&gt; that seems to be superior to both Akephalos and Selenium in many regards.  They have integrated &lt;a href="http://doc.qt.nokia.com/4.7/qtwebkit.html"&gt;QtWebKit&lt;/a&gt;, which appears to be a library to enable cross platform development using the popular WebKit which powers Chrome, Safari and most mobile browsers.  The beauty of the solution is that it seems to be really fast, it supports advanced features like drag &amp;amp; drop which were not possible with Akephalos, yet this can all be achieved without opening up a browser which was required previously through the use of Selenium.  &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/commit/90831b065872527232c4bfc7285f9fab7d66becb"&gt;I&amp;#8217;ve updated the Git repository with the changes&lt;/a&gt; so you can see how little you need to do to get Capybara-Webkit to replace both web drivers.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;That&amp;#8217;s it&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#8217;ve got a test suite I&amp;#8217;m pretty happy with now that reliably tests both back end and front end code with both unit and integration tests.  It works well with the latest version of Ruby 1.9.2 and Rails 3.0.  Thanks certainly goes to Capybara, RSpec2, Cucumber, Selenium, Akephalos (and now Capybara-Webkit), Watchr and Spork.  The only thing I&amp;#8217;m not entirely convinced with at the moment is the use of Watchr to automatically invoke Cucumber as the Cucumber tests can be particularly slow, but I&amp;#8217;m sure each person will have their preference.&lt;/p&gt;
&lt;p&gt;You can see the full source code at &lt;a href="https://github.com/mattheworiordan/Full-stack-testing/"&gt;&lt;a href="https://github.com/mattheworiordan/Full-stack-testing/"&gt;https://github.com/mattheworiordan/Full-stack-testing/&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The live (and pretty pointless) demo project is up at &lt;a href="http://full-stack-testing.heroku.com/"&gt;&lt;a href="http://full-stack-testing.heroku.com/"&gt;http://full-stack-testing.heroku.com/&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Useful links I came across whilst researching this article&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="https://github.com/mynyml/harmony"&gt;Harmony&lt;/a&gt; - DOM + Javascript testing from within Ruby test frameworks such as mini test, unit test, RSpec.  Please note that this project appears to be outdated and does not support Ruby 1.9.2.  This library depends on &lt;a href="http://env-js.appspot.com/"&gt;&lt;a href="http://env-js.appspot.com/"&gt;http://env-js.appspot.com/&lt;/a&gt;&lt;/a&gt;, which has been superseded by &lt;a href="https://github.com/thatcher/env-js"&gt;&lt;a href="https://github.com/thatcher/env-js"&gt;https://github.com/thatcher/env-js&lt;/a&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://selenium.rubyforge.org/"&gt;Selenium Ruby&lt;/a&gt; - looks outdated, last news was 2007&lt;/li&gt;
&lt;li&gt;&lt;a href="http://code.google.com/p/selenium/wiki/BuildingWebDriver"&gt;WebDriver Selenium project page&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/langalex/culerity"&gt;Culerity&lt;/a&gt; - Celerity without the need to run your Ruby code in JRuby &lt;/li&gt;
&lt;li&gt;&lt;a href="http://watir.com/"&gt;Watir&lt;/a&gt; - browser automation in Ruby, similar to Selenium, not clear on why Watir over Selenium, other than lack of Java.  Good article on the &lt;a href="http://www.io.com/~wazmo/blog/archives/2005_02.html#000229"&gt;differences between Watir and Selenium&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/smparkes/capybara-envjs"&gt;Capybara and Envjs&lt;/a&gt; (ruby 1.8.*, no ruby 1.9.2 support)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://code.google.com/p/js-test-driver/wiki/GettingStarted"&gt;JsTestDriver&lt;/a&gt; - run multiple unit tests across different browsers simultaneously&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/jnicklas/capybara"&gt;Capybara&lt;/a&gt; - testing framework supporting numerous headless and headed browsers&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/rspec/rspec-rails"&gt;RSpec rails extension&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://stackoverflow.com/questions/3551891/asynchronous-unit-tests-in-ruby"&gt;Dealing with aSynchronous requests when testing&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;What next?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I would like to get this all working with a continuous build server which not only runs the full suite of tests whenever commits are pushed, but also runs the front end tests across multiple browsers including multiple operating systems.  I think I&amp;#8217;ll be using Selenium and possibly &lt;a href="http://code.google.com/p/js-test-driver"&gt;JsTestDriver&lt;/a&gt; with &lt;a href="https://github.com/jivesoftware/QUnitTestRunnerPlugin"&gt;QUnitTestRunnerPlugin&lt;/a&gt;, but that&amp;#8217;s for the next article.  I&amp;#8217;ll be working on that as soon as I can, and I&amp;#8217;ll post a new blog post when it&amp;#8217;s ready.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Follow me on &lt;a href="http://twitter.com/#!/mattheworiordan"&gt;@mattheworiordan&lt;/a&gt; &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span&gt; &lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;strong&gt;&lt;span&gt;If you have any questions, suggestions, or corrections, please do get in touch &lt;a href="http://mattheworiordan.com/"&gt;Matthew O&amp;#8217;Riordan&lt;/a&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt; &lt;br/&gt;&lt;/strong&gt;&lt;/p&gt;</description><link>http://blog.mattheworiordan.com/post/4701529828</link><guid>http://blog.mattheworiordan.com/post/4701529828</guid><pubDate>Sun, 17 Apr 2011 23:48:00 +0100</pubDate><category>rails</category><category>cucumber</category><category>capybara</category><category>rspec</category></item><item><title>Do it, donate to Wikipedia, they need it and you can afford it</title><description>&lt;p&gt;I decided to donate to &lt;a href="http://www.wikipedia.org/"&gt;Wikipedia&lt;/a&gt; today not because I feel especially altruistic today, but because of the following:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;It&amp;#8217;s genuinely a brilliant website, and it costs money, lots of money to keep it going.  I have and continue to gain a lot of benefit from its existence, so I want to ensure it continues to live on the web.&lt;/li&gt;
&lt;li&gt;As I continue to embrace open source software and the open source community, I realise how powerful it is not just for software development, but for the mankind and the planet as a whole to collaborate and contribute to a greater good. Wikipedia plays a valuable role in education globally, and provides this freely.&lt;/li&gt;
&lt;li&gt;I don&amp;#8217;t want advertising on Wikipedia, or for them to succumb to financial incentives which will inevitably result in the site being directed away from simply presenting information from as many perspectives as possible (which is fortunately completely different to being objective, and is arguably one the reasons why Wikipedia is brilliant and survives)&lt;/li&gt;
&lt;li&gt;Wikipedia is suffering at the moment because editors and moderators are dropping like flies.  Whilst I am not yet ready to take on that responsibility, I do hope that my contribution at least helps them to find ways to solve that problem.&lt;/li&gt;
&lt;li&gt;It&amp;#8217;s Christmas dammit, they deserver a present.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Come on, &lt;a href="http://wikimediafoundation.org/wiki/Support_Wikipedia/en"&gt;join me and donate to Wikipedia&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Matt&lt;/p&gt;</description><link>http://blog.mattheworiordan.com/post/298595112</link><guid>http://blog.mattheworiordan.com/post/298595112</guid><pubDate>Thu, 24 Dec 2009 15:55:26 +0000</pubDate></item><item><title>Why I chose tumblr over Posterous</title><description>&lt;p&gt;I recently set up my personal blog as I am desperately looking for exciting new ways to waste my time expressing myself online.  As I am spending quite a bit of time learning &lt;a href="http://rubyonrails.org/"&gt;Ruby on Rails&lt;/a&gt; recently, I thought my best bet would be build myself a little blog in RoR and that would give me another excuse to use my new skills.  However, I soon realised that building my own blog would only result in the following:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Extreme time wastage reinventing the wheel.  Considering the time I am about to waste posting stuff into my blog, I thought it rather excessive wasting even more time building my own blog.&lt;/li&gt;
&lt;li&gt;Blog software is surprisingly sophisticated now, getting my blog to support any of the cool features that I&amp;#8217;ll probably soon want is going to take a long time.&lt;/li&gt;
&lt;li&gt;Design and interface will suffer - I am not a designer and although I think I have a keen eye for good design, I will only disappoint myself trying to build something I actually think looks good.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;So I then thought, heck, WordPress is probably the most infamous blogging platform out there, why not just use that.  It has loads of free and paid for themes/skins so it could look good, it has 1,000s of plugins (one of which &lt;a href="http://wordpress.org/extend/plugins/dev-and-staging-environment/"&gt;I recently contributed&lt;/a&gt;, albeit a simple and rather shoddy one) so bound to have everything I need.  But again, I decided against this because:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;I really cannot be arsed to waste my time pissing about with setting up a database, WordPress themes, templates, tweaking things I don&amp;#8217;t like, removing all the fat in the features by turning them off etc.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.codinghorror.com/blog/archives/001119.html"&gt;PHP sucks&lt;/a&gt; and &lt;a href="http://wordpress.org/"&gt;WordPress&lt;/a&gt; is a good example of what PHP is - a mess of code that is held together with cheap masking tape.  Don&amp;#8217;t get me wrong, PHP can be good, but it doesn&amp;#8217;t encourage good practices so larger applciations just become a big mess.  After recently doing two WordPress websites for a bit of fun, I don&amp;#8217;t particularly feel like working in WordPress again.  Please note, that I do still think WordPress is genius if you want to get something up quickly and will largely just do the job, but personally I don&amp;#8217;t want to look at the code base ever again or have to tinker with that big smelly pile of code.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;So my next 2 options were &lt;a href="http://www.tumblr.com"&gt;Tumblr&lt;/a&gt; or &lt;a href="http://posterous.com"&gt;Posterous&lt;/a&gt;.  Both of them I believe are superb blogging platforms because they&amp;#8217;re simple, they&amp;#8217;re pretty feature rich but the features are solely focussed on blogging and or micro-blogging to some extent.&lt;/p&gt;
&lt;p&gt;Posterous seems to be the favourite generally at the moment as it has some really nice features (or possibly gimmicks) that I suspect attract people.  It allows you to start your blog without an account by just simply emailing Posterous.  Its great for group publishing i.e. managing multiple blog authors.  It allows automatic republishing of content into other blogs (although I am not quite sure why one would want to do this unless you are simply creating links back to your content which kinds of defeats the purpose of having a blog if all it is is links&amp;#8230; why not just use Twitter).  I set up my blog, pointed a sub-domain of mattheworiordan.com to it, and everything was up in around 15 minutes.  Pretty impressive, but I wanted to give Tumblr a try to.&lt;/p&gt;
&lt;p&gt;I got set up with Tumblr equally quickly.  The only gripe I had with Tumblr was to do with their WYSIWYG support for Chrome on Mac, but considering it was only out for a few days I can&amp;#8217;t really complain about that.   What I loved about Tumblr was their wide array of themes I could choose from which were generally very nice, and the sensible set of features.  I don&amp;#8217;t think there is anything in Tumblr that I need that is not already there.  I did have one small issue with Tumblr, I emailed their support and got an email back within minutes - awesome, considering it&amp;#8217;s a free service.&lt;/p&gt;
&lt;p&gt;So I have chosen Tumblr as my blogging platform because:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;It&amp;#8217;s more me in terms of design, interface, general usability.  It looks good and that&amp;#8217;s important whenever people interact with my content.&lt;/li&gt;
&lt;li&gt;It has a groovy Mac Widget which allows me to post quickly to my blog.&lt;/li&gt;
&lt;li&gt;I can use email or even phone in and post something to my blog, yup, I can phone in (although it&amp;#8217;s an American number)&lt;/li&gt;
&lt;li&gt;It allows me to post links back to my posts into my Twitter account (a place where reposting seems sensible)&lt;/li&gt;
&lt;/ul&gt;</description><link>http://blog.mattheworiordan.com/post/295322035</link><guid>http://blog.mattheworiordan.com/post/295322035</guid><pubDate>Tue, 22 Dec 2009 17:48:49 +0000</pubDate><category>tumblr</category><category>posterous</category><category>blogging</category></item><item><title>Google Chrome billboards literally outside my home</title><description>&lt;p&gt;I&amp;#8217;m not quite sure what to make of it. Madness, or genius? I am in some way confused though as to why Google chose to develop their own Chrome browser when they could have just supported Mozilla in their efforts to build their own browser (which I love bar the speed and lack of page tabs at the top).&lt;/p&gt;
&lt;p&gt;Although Chrome is open source, I do wonder how many people actually contribute to Chrome other than Google employees..&lt;/p&gt;
&lt;p&gt;&lt;img alt="Billboard photo from thenextweb.com, not actually outside my home!" src="http://thenextweb.com/uk/files/2009/12/e0gn-1.jpg"/&gt;&lt;/p&gt;</description><link>http://blog.mattheworiordan.com/post/283425707</link><guid>http://blog.mattheworiordan.com/post/283425707</guid><pubDate>Mon, 14 Dec 2009 18:07:00 +0000</pubDate></item><item><title>Even Google employs idiots</title><description>&lt;p&gt;After setting up the fantastic Google Apps Enterprise Edition for my email on my domain, I ran into some issues when I tried to migrate my 5GB of email from my Exchange 2007 server to Google Apps.&lt;/p&gt;
&lt;p&gt;So I contacted their support service which is a commercial service they offer because I pay for the Enterprise Edition, and I was kindly taken care of by a technical support idiot who had no understanding of the issue, and was entirely unable to respond to the problem.&lt;/p&gt;
&lt;p&gt;See the thread of &lt;a href="http://www.google.com/support/forum/p/Google+Apps/thread?tid=50bb61a563e41464&amp;amp;hl=en&amp;amp;fid=50bb61a563e4146400047ab3598ec0ed"&gt;an idiot at Google&amp;#8217;s incompetence here&lt;/a&gt; which provides some insight into what happened.&lt;/p&gt;
&lt;p&gt;To be fair, it&amp;#8217;s not fair to think that Google could only employ geniuses and run a slick operation, but I think it demonstrates how a software/internet business which once required very little human interaction cannot be sustained when it needs people to scale.&lt;/p&gt;
&lt;p&gt;I do hope my next venture requires few people and scales well. Although I&amp;#8217;d of course be happy if it turned out to be a Google even if it did employ a few idiots amongst geniuses.&lt;/p&gt;</description><link>http://blog.mattheworiordan.com/post/283382951</link><guid>http://blog.mattheworiordan.com/post/283382951</guid><pubDate>Mon, 14 Dec 2009 17:19:00 +0000</pubDate></item><item><title>"Life is short, go large"</title><description>“Life is short, go large”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;Eli Thompson&lt;/em&gt;</description><link>http://blog.mattheworiordan.com/post/282515513</link><guid>http://blog.mattheworiordan.com/post/282515513</guid><pubDate>Mon, 14 Dec 2009 02:08:44 +0000</pubDate></item><item><title>Lemon Studios website is now up on Wordpress</title><description>&lt;a href="http://lemonstudioslondon.com/"&gt;Lemon Studios website is now up on Wordpress&lt;/a&gt;</description><link>http://blog.mattheworiordan.com/post/282499146</link><guid>http://blog.mattheworiordan.com/post/282499146</guid><pubDate>Mon, 14 Dec 2009 01:56:49 +0000</pubDate></item><item><title>I've decided to have a blog</title><description>&lt;p&gt;Because everyone else seems to think it&amp;#8217;s a good idea and there&amp;#8217;s no point me bucking that trend. I&amp;#8217;ve been told that Posterous and Tumblr are both fantastic to get up and running quickly, so this is my exploration into which one is right for me. What I&amp;#8217;m looking for is a beautiful yet simple interface for users, and stupidly quick and simple for me to get content up. &lt;a href="http://mattheworiordan.com/"&gt;http://mattheworiordan.com/&lt;/a&gt; @mattheworiordan&lt;/p&gt;</description><link>http://blog.mattheworiordan.com/post/282497504</link><guid>http://blog.mattheworiordan.com/post/282497504</guid><pubDate>Mon, 14 Dec 2009 01:55:33 +0000</pubDate></item></channel></rss>

