class EasyMultilineTestTest extends Specification {
def '''This is a
Multi-Line!!!
Test - Does it show an output?'''() {
when:
def x = 5
then:
x == 6
}
}
I’d stay away from multi-line method names because JUnit doesn’t handle them correctly:
import org.junit.runner.Description
import spock.lang.Specification
class MultiLineSpec extends Specification {
def "multi line method description"() {
def d = Description.createTestDescription(MultilineSpec.class, "multi\nline\nmethod")
expect:
d.className == MultiLineSpec.name // fails; returned value is "multi\nline\nmethod(MultilineTest)"
d.methodName == "multi\nline\nmethod" // fails; returned value is null
}
}
Maybe it would be a good idea to disallow multi-line method names in Spock.
I thought this could be an issue with the jUnit runner Do you know if there is a fix under way to fix jUnit? Can I use html-tags to make line-breaks into the jUnit report?