It looks to me that testing has come a long way since SUnit, JUnit, and the common xUnit test frameworks.
I looked into RSpec and Cucumber to get an idea what 'behavior-driven' testing is about, but now I do wonder which kind of other approaches to writing unit-tests exist.
I am not tied to any particular language, but more interested in general ideas and approaches to test code.
So, my question is, which stylistically different approaches are there to unit testing, i.e., approaches different from "asserts".
Let me give examples:
The xUnit style of unit-testting looks roughly like this in your favorit language:
stack = new Stack()
assertTrue (stack.empty())
stack.push(1)
assertFalse (stack.empty())
assertEquals(1, stack.top())
RSpec-style unit-testting looks rather like this (roughly improvised):
describe Stack do
it "should be empty" do
Stack.new.empty?.should == true
end
it "should contain new value on top" do
stack = Stack.new
stack.push(1)
stack.empty?.should == false
stack.top().should == 1
end
end
Are there other interesting styles, notations, 'DSLs'? Sure, every language and framework will have variations on the theme, but are there different general 'themes'/styles?