Reputation: 9761
How do scalatest and spock differ? what is the added-value of each ? Which is more agile for Behavior Driven Development (BDD)? Please could you share some thoughts on the matter ?
I want to start BDD, I want to pick one between the two, therefore I'd like to make an educated decision. Hence i get the maximum of information first, especially given that I'm a java programmer and that scala seem to have a learning curve that is important.
Any advise or ideas or return from experiences would be welcome.
Many thanks
Upvotes: 15
Views: 3609
Reputation: 3460
While I agree with Peter's answer, I'd like to give my perspective on this.
Both ScalaTest and Spock provide fluent BDD test. However I find that the best feature of Spock is that you can to create single scenario with multiple set of data and expected results. This is very much like Cucumber's Scenario Outline, only run at unit test level.
I can't find other unit test framework/library that does that.
In summary, if you need to test multiple input/output for single test scenario, use Spock, otherwise, feel free to choose whatever you feel comfortable with.
Upvotes: 6
Reputation: 123920
In a nutshell, I would recommend to use ScalaTest for testing Scala code, and Spock for testing Java or Groovy code. (Of course, it's also perfectly possible to test Java code with ScalaTest.) Why not give both tools a shot and stick with the one that you are more comfortable with?
Disclaimer: I'm the creator of Spock.
Upvotes: 33