[rspec-users] tags/categories for specs

Mark Ryall mark.ryall at gmail.com
Thu Apr 3 08:48:19 EDT 2008

Many thanks to David Chelimsky for answering my question about :type &
:behaviour_type hash key:


It has made me curious to know whether tagging specs is a feature anyone has
requested before.

The current project i'm working on has a vast number of specs - most using
selenium - and consequently a very long build (cruisecontrol).

We have a few of different independant streams of development, all working
on the same codebase, each having an associated 'precheckin' build.  We try
to make sure these only take up to 10-15 mins by running a relevant subset
of the specs.  We'd ideally run the full build locally before every commit
but we optimistically commit when the relevant precheckin build passes just
so we can check in more frequently (the build server always runs the full
build).  There's effort going into reduing the overall build time (selenium
grid and various other ideas) but this is a reasonable option right now.

Currently we achieve this crudely by having a custom spec runner that loads
specs according to whether the filename matches a set of inclusion regular
expressions and doesn't match a set of exclusion regular expressions (each
stream has a set of filters).  A simpler method might have just been to put
the specs in different directories but it's convenient to be able to include
the same spec in more than one of these precheckin builds.

It would be really cool to have just been able to write specs like this:

describe 'some piece of functionality', :tags => [:ui, :search] do

describe 'some other piece of functionality', :tags => [:ui] do

and then execute only the first spec as a result of launching something like
'spec --tags search' - all of the specs can be loaded but only those that
match the specified tag would be executed.

Having poked around the code a little, it doesn't seem impossibly difficult
to implement.

Does the idea have any appeal to anyone?  It doesn't seem an especially
original idea so I wonder if anyone has already had a go at implementing it?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080403/b654804f/attachment.html 

More information about the rspec-users mailing list