I'm a relative newbie to both this group and easyb, so take the
following for what it's worth:
My first thought was similar to what Andy posted: iterate through a
collection of different List implementations. The more I thought
about it, though, the more I realized that this might be a place where
easyb might be pointing out a potential weakness in our design.
Assuming that we have an interface with a number of classes that
implement that interface, I would think that if the behavior in the
implementations is the same (i.e. the scenarios test *exactly* the
same thing for each implementation with *exactly* the same outcomes),
then we might want to refactor that behavior into an abstract class
from which those implementations now inherit. We can then write a
story to test the behavior of that abstract class, with separate
stories (sequels?) for the classes that inherit from that abstract
class. At that point, if a class inherits behavior from an abstract
class, then you only need to test the behavior in the story for the
abstract class and not really worry about which implementation you're
using, provided it doesn't actually override the behavior in the
abstract class. If a class *does* override the behavior in the
abstract class, then that behavior would be tested in the story for
the inheriting class, along with any other behavior it provides.
Taking List as an example: ArrayList and LinkedList don't directly
implement List (i.e. they don't provide the definitions for all the
required methods themselves). Instead, most of their behavior is the
same and is actually inherited from AbstractList which implements the
List interface. The only public abstract method in AbstractList is
get(). So I would propose that we might have a single story that
tests the behavior of AbstractList, then following stories that test
the specific behavior of get() in ArrayList and LinkedList (which
actually lies a bit further down in the inheritance tree so might test
other things as well).
I wrote in a blog post a few days ago, that easyb not only helps the
customers/stakeholders understand what's being tested, but also helps
me see how the pieces of my projects work together. I think this is
one more place where easyb is a great aid in seeing how we might
design our projects, too. Could we say BDD is also "behavior driven
design" (but then, I would hope most design "behavior-driven")?
je