This is my experiment, see the HTML (contains the stacktrace within
<pre>...</pre>) and a picture attached.

<dependencies>
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <version>5.4.1</version>
        <scope>test</scope>
    </dependency>
</dependencies>

...

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>3.0.0-M3</version>
</plugin>
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jxr-plugin</artifactId>
    <version>2.3</version>
</plugin>
<plugin>
    <artifactId>maven-surefire-report-plugin</artifactId>
    <version>3.0.0-M3</version>
</plugin>


here is MyTest.java:

import org.junit.jupiter.api.Test;

class MyTest
{
    @Test
    void test() {
        throw new RuntimeException();
    }
}

*$ mvn test*

[INFO] Running MyTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed:
0.037 s <<< FAILURE! - in MyTest
[ERROR] test  Time elapsed: 0.032 s  <<< ERROR!
java.lang.RuntimeException
    at MyTest.test(MyTest.java:7)

[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR]   MyTest.test:7 Runtime
[INFO]
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

*$ cat target/surefire-reports/TEST-MyTest.xml*

<testsuite ...>
...
  <testcase name="test" classname="MyTest" time="0.032">
    <error type="java.lang.RuntimeException">java.lang.RuntimeException
    at MyTest.test(MyTest.java:7)
</error>
  </testcase>
</testsuite>


*$ mvn site*

*$ cat target/site/surefire-report.html*


<div id="MyTest.test-error" style="display:none;">
<div>
<pre>java.lang.RuntimeException
    at MyTest.test(MyTest.java:7)</pre></div></div></td>
<td></td></tr></table></div><br /></div>


[image: obrázok.png]




On Tue, May 7, 2019 at 11:18 PM Laird Nelson <[email protected]> wrote:

> On Tue, May 7, 2019 at 2:07 PM Tibor Digana <[email protected]>
> wrote:
>
> > strange thing is that the new line is ignored.
> >
>
> Lurking here, but (a) I thought <systemPropertyVariables> in a forked
> execution were indeed passed on the command line as -D arguments, (b) the
> behavior may have to do instead with the fact that whitespace in XML is
> generally not significant so after &#x0A; is expanded it is effectively
> stripped/trimmed from the XML yielding the empty string, and (c) the OP
> could try CDATA and an actual line separator character instead, maybe?
>
> Best,
> Laird
>

Reply via email to