[rspec-users] [rspec] loading specs as an object model without running them

Kero van Gelder kero at chello.nl
Wed Apr 29 17:59:41 EDT 2009

>>> So basically, I want to do something like this:
>>> examples = load_examples_without_running
>>> examples.each {|example| puts example.description}


> I'm working into a big corporate in Australia, and they are demanding  
> traceability of tests back to requirements.  I'm already using Mingle to 
> manage story cards, and I'm hoping to let the testers build in the  
> traceability via code.  So I've got a Mixin to the examples so that I  
> can declare the id of the story that the test maps to.  It looks  
> something like this:
> describe FunctionalArea do
>   it "automates some acceptance test declared on a story" do
>     traces_to_story 35
>     # test implementation
>   end
> end

I would have expected Cucumber to map stories to scenarios/examples
by having them in the same file (and a @tag if someone insists that
a number referrring an external doc is better for tracability).

I would have expected RSpec to cover a lower level that is of no
interest to the person wanting traceability, as that person can not
judge whether the code works anyway (YMMV). Besides, a spec can
apply to more than one requirement; or to no particular requirement at all.

I'm expecting this from regulations that deal with medical devices.
Validation has to happen on story level; risk mitigation may apply
to lower levels, though. Our department is working on several projects
that'll result in medical devices and we are learning how regulations,
audits and things work for real.

So I'd like to hear why you are trying to do what you do.

There can be other requirements for other reasons. What traceability
are you looking for in these tests? Why do you look at the RSpec

How can I change the world if I can't even change myself?
  -- Faithless, Salva Mea

More information about the rspec-users mailing list