Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A comparison of ScalaTest and Spock

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

like image 515
MaatDeamon Avatar asked Apr 19 '13 14:04

MaatDeamon


People also ask

Is Spock better than JUnit?

As we can see, Spock has more readability and a clearer documented code, it does not need 3rd parties, and it is more powerful than JUnit. In the end, using Spock or JUnit or TestNG or anything else is absolutely up to you. They each have their pros and cons for sure.

What is ScalaTest used for?

Scala provides type inference for variables and functions, much better than limited type inference in Java and C#. It also provides a compiler that uses type reference to a full extent. Applications of Scala provides various libraries and hence it can be used to build many frameworks.


1 Answers

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.

like image 195
Peter Niederwieser Avatar answered Oct 22 '22 03:10

Peter Niederwieser