Spock multi-line test method names do not show up in jUnit reports

I have the following Spock testcase:

class EasyMultilineTestTest extends Specification {
            def '''This is a
Multi-Line!!!
Test - Does it show an output?'''() {
         when:
         def x = 5
         then:
         x == 6
     }
}

When I execute this via

gradle test

I get the following jUnit report file:

<?xml version="1.0" encoding="UTF-8"?>
<testsuite errors="0" failures="0" hostname="PCVMW012" name="EasyMultilineTestTest" tests="0" time="1.95" timestamp="2012-06-19T08:24:27">
  <properties />
  <system-out><![CDATA[]]></system-out>
  <system-err><![CDATA[]]></system-err>
</testsuite>

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 :frowning: 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?

Do you know if there is a fix under way to fix jUnit?

I’m not aware of a fix being underway. Best ask the JUnit folks.

Can I use html-tags to make line-breaks into the jUnit report?

You’d have to try.