Pages

Monday 11 March 2013

Get Sinatra to sing it your way


Everybody in software loves up to the minute statistics. Including being able to stay abreast of the latest test run from anywhere. So why not go one step further and have Sinatra sing it for you. 




In ancient times they had no statistics, so they had to fall back on lies Stephen Leacock


This may sound a little strong, but I've heard it become a reality in the workplace far too many times:

Smith: "I say Perkins, you're scrum master for the web store. How are the latest test runs looking?"
Perkins: "I... Uh... They're... They're looking spiffing Smith. All just fine. We'll be releasing bang on time."

Problem is, the test runs aren't looking spiffing. They look terrible. And there isn't a snowball's chance in hell that the release is going to be bang on time. Problem is, Perkins wasn't paying attention in the daily standup, one too many sherrys last night meant all he could think about was the paracetamol in Victoria from HR's desk. If only he'd had something quick and meaningful to look at. Something that was green when all was well, and red when things were decidedly not well. But that also had all the detail he could wish for should he need the facts. If only the web store test department had known Sinatra.


Don't allow others to lie when it comes to your reputation. Get Sinatra to sing the truth for you. Tweet this post


You'll be amazed at how little it takes to get Frank up and performing


If you're outputting your test runs in HTML format (–format html –out latest_run.html) Cucumber has already done most of the heavy lifting, you just need to follow a few additional steps. First, install the Sinatra gem 'gem install sinatra'. Next, create a file called broadcast_results.rb or similar in the same folder as your HTML output and paste in the following:


Now, in a terminal window navigate to the folder containing the broadcast_results.rb file and run 'ruby broadcast_results.rb'. You'll see output (run in a screen session if you want to close or reuse this terminal window) that looks like this... 

== Sinatra/1.3.3 has taken the stage on 4567 for development with backup from WEBrick
 [2013-03-11 14:39:31] INFO  WEBrick::HTTPServer#start: pid=8852 port=4567

which means you're done. Navigate to localhost:4567 in a browser and you'll see Cucumber's HTML output displaying the latest test run. If you want others to view these results too, simply replace localhost with your IP address and Sinatra will take care of the rest.

If you found this post helpful, please share it. If you have any questions, or use another method to broadcast your test results quickly and easily, please comment below or tweet me.

No comments:

Post a Comment