Finding a way to make your test results readily available to those interested makes life easier for all involved. Doing this in an an always-on automated fashion is even better. For a long time I happily used Ruby on Rails to do this, but Ruby on Rails is designed for a lot more than this simple broadcast. Sinatra is a web “micro framework”, which makes it easy to do quick simple tasks, as well as build applications from the ground up without being forced to use MVC. Let’s use Sinatra to display a HTML file that has been output by a Cucumber test run.
To get Cucumber to to output results in a nicely formatted HTML page, use the following to run the test:
cucumber Blah.feature –format html –out Blah_result.html
Install sinatra with “gem install sinatra“
Now in the same folder as your result file, create a file, lets call it sinatra.rb
Add the following lines:
require ‘rubygems’
require ‘sinatra’
get ‘/’ do
File.read(“Blah_result.html”)
end
On the command line run : ruby sinatra.rb
You should get :
== Sinatra/1.0 has taken the stage on 4567 for development with backup from WEBrick
Now browse to http://localhost:4567 to view your html file.
By replacing localhost with your ipaddress, anyone can view the latest test result.


hey, tried running the commands in your example but kept getting unrecognised command for Blah_result.html
I’m using rubygem cucumber 0.10.0
Apologies. Put –out before the name of the HTML file.
e.g.
cucumber Test1.feature –format html –out Result.html
I’ll update the post accordingly. Thanks.