Spock provides @Narrative
and @Title
annotations that you can use to provide a class-level description of your test, e.g.
@Narrative('description of spec')
@Title('title of spec')
class ExampleSpec extends Specification {
// tests omitted
}
What is the difference between these two? In other words, why do we need both of them, when they seem to serve the same purpose?
Title is expected to be a single line (short description)
Narrative should be full paragraphs (using a Groovy multi-line string)
They are mostly used in big projects where Narrative text could be read by business analysts, project managers e.t.c.
As Opal said these will be more useful once some reporting tools actually use them.
Update: The Spock reports project now supports these annotations.