开发者

JUnitReport HTML - Unit Test Results Order

开发者 https://www.devze.com 2023-02-05 06:04 出处:网络
开发者_运维知识库Does anyone know if it is possible to order the HTML page generated by the junitreport task in ant to order the test results by timestamp rather than alphabetically by Class name.
开发者_运维知识库

Does anyone know if it is possible to order the HTML page generated by the junitreport task in ant to order the test results by timestamp rather than alphabetically by Class name.

The report does show the timestamp but I can't find anyway to sort the results by it. I would like the default to be sorting by timestamp.

Many thanks, Stef


JUnitReport uses XSL stylesheets in order to transform the raw XML files into HTML files. You might change the stylesheets in order to generate custom HTML (and thus sort by timestamp). One your stylesheets work, use the styledir attribute (see http://ant.apache.org/manual/Tasks/junitreport.html) to tell ant to use your stylesheets rather than the default ones.


Thanks to your post above I found the solution which involved using a custom stylesheet (a modified version of the default xsl file) as you suggested.

I changed line 656 from:

<xsl:sort select="@name"/>

to

<xsl:sort select="@timestamp"/>

and it did exactly what I wanted.

Thanks again for your help.

Cheers, Stef


You can also jQuery tablesorter (tablesorter.com) to the resulting html file to get sorting goodness. That's what I just did. Chrome crashes for some reason, but Firefox and Safari seem ok.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号