Home
> Spock Framework > Poll: Help us make Spock rock the (testing) universe!
Poll: Help us make Spock rock the (testing) universe!
Since its first release in March 2009, Spock has come a long way. Time to ask you where to head next! Please take a moment to share your thoughts. Thanks!
Categories: Spock Framework
For me the number 1 enhancement that could be made to Spock would be to have re-usable ‘steps’ in the manner of JBehave and Cucumber. Not only does this promote re-use without cluttering the codebase with helper methods but it promotes QA involvement in writing the specs in the first place. Right now the labels on Spock given/when/then/and blocks are purely documentation and therefore prone to going stale in the same way as comments.
Rob,
do you have any concrete ideas what BDD support in Spock could look like? How would stories, scenarios, and steps be defined? Why would someone choose Spock for his BDD needs instead of, say, Cucumber, JBehave, or easyb?
If I have a couple of specs that start with something like
given: “user x is logged in”
right now I have to either re-implement the login code in each spec or pull it into a helper method somewhere. If instead I could implement a rule that matches the text of the given block (I appreciate that could be tricky, although I’m not sure if/how block labels are represented in byte code) I could reuse a similar “given” block in many places. Even more powerful would be the ability to extract parameters so
given “3 users exist”
and
given “2 users exist”
could be implemented by the same rule.
I’m not suggesting losing the ability to define the steps in the spec as right now, but having “empty” blocks get interpreted by rules would be great for re-use.
As I say, I’m not sure how realistic this would be or how well it would fit in with how you envisage Spock being used. Sorry if this is all a bit vague.
The strengths for me of Spock right now are the mocking framework, the expressive assertions, the data-driving via “where” block, etc. I think those things set Spock apart from other frameworks (including JUnit).
Even though I think Spock is better (for the reasons Rob mentioned above), I had to choose easyb for my project because it provides simple but nice HTML reports, something my manager wanted. The day Spock provide these, I will immediately switch back (code is not difficult to port).
Better documentation with more real world type examples would make a huge difference.