Scalatest BDD: Spec vs. WordSpec vs. FlatSpec, which should I use?

In Scalatest, I'm a little unclear regarding the advantages and disadvantages of using Spec over WordSpec. I think javadoc provides some degree of comparison between WordSpec and FlatSpec, but I have no idea about Spec and WordSpec.

What will be considered "best practice" if you are comfortable with the syntax?

Is WordSpec an evolution of Spec (if you agree that BDD is an evolution of TDD)? Or vice versa? If in this respect they are completely equal, why should I choose one by one?

This may be a "religious question", but even if it is the ones that on each side should at least have some pros and cons that they would like to point out. I would be very interested to hear these arguments.

If this is FREQUENTLY ASKED QUESTIONS, I apologize in advance: I could not find anything in my searches for this comparison.

+6
source share
1 answer

Spec has no implicit conversions except the default value that you get with Suite, which puts === in everything. WordSpec has several implicit conversions to put words after lines, so it has a slightly greater risk for an implicit conversion conflict.

Spec allows for indefinite embedding. WordSpec provides only 3 levels of nesting.

Spec gives you more freedom in how you structure the text of your specification (although not as much freedom as FreeSpec). WordSpec pretty much prescribes how you structure your text.

WordSpec is more DSLish than Spec. Some people prefer this.

If people do not have a preference, I point them to Spec as the default choice, because by default it has fewer implications, more freedom, less DSL and more nesting, but first of all this choice is a matter of taste.

+15
source

Source: https://habr.com/ru/post/903924/


All Articles