Or I could try to convert the timezone in the junitreport but I'm not sure how do-able that would be in XSLT.

If you do it in the stylesheets, you don't need to alter JUnit java code.
This link shows the XSLT functions you need, and some examples:
http://www.xsltfunctions.com/xsl/fn_adjust-datetime-to-timezone.html

Regards, Jan

----- Original Message ----- From: <[EMAIL PROTECTED]>
To: <dev@ant.apache.org>
Sent: Friday, August 24, 2007 9:03 AM
Subject: AW: timezone for junitreport, and antlib


The timestamps displayed by the 1.7.0 junitreport are in the GMT timezone. It looks like that's determined by DateUtils.createDateFormat() via the junit task's XMLJUnitResultFormatter.startTestSuite().


public class XMLJUnitResultFormatter ...
   public void startTestSuite(JUnitTest suite) {
       ...
       //add the timestamp
       final String timestamp = DateUtils.format(new Date(),
               DateUtils.ISO8601_DATETIME_PATTERN);
       rootElement.setAttribute(TIMESTAMP, timestamp);



public final class DateUtils {
   /**
    * ISO8601-like pattern for date-time. It does not support timezone.
    *  <tt>yyyy-MM-ddTHH:mm:ss</tt>
    */
   public static final String ISO8601_DATETIME_PATTERN
           = "yyyy-MM-dd'T'HH:mm:ss";



Yes it's done there ;)




I'd like to display them in my local timezone, or at least in the timezone in which the junit task was run. Does anyone know how to do this? It looks like I'd need to change Ant.


It is not possible atm in Ant.



I could try adding an attribute to the junit formatter element for
using
the local (or an arbitrary) timezone, altho I don't know if it would apply to the other types of formatter. Or I could try to convert the timezone in the junitreport (junit-frames.xsl and junit-noframes.xsl), but I'm not sure how do-able that would be in XSLT. Which approach would be acceptable to a committer?


When I wrote the FailureRecorder (<formatter type="failure"/>) I got the
problem
how to configure that recorder. Passing attributes is not simple there,
as this is
not a task. Its not a ProjectComponent, it is a simple class.

I have done this using magic System properties
(ant.junit.failureCollector) so I could
specify the configuration via nested <sysproperty>.



By the way, is anyone working on externalizing the junit support to an antlib? JUnit 4 works well enough on Ant 1.7.0, but the report still doesn't support some features as well as it could, such as @Ignore.


The Ant team does not have a JUnit AntLib - neither as project nor in
the sandbox.
I dont know if the JUnit team has. If I remember right, it was said,
that they would
maintain a JUnit AntLib ... but I dont know what the status is.


Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to