ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: timezone for junitreport, and antlib
Date Fri, 24 Aug 2007 07:03:53 GMT
>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: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message