"Curt Arnold" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>
> On Mar 20, 2006, at 12:39 PM, Jesse Glick wrote:
>
>> Curt Arnold wrote:
>>>> when Ant auto-detects JUnit-4, it doesn't look for the static
>>>> suite()  method, and just assumes that you've defined all of your
>>>> tests with Annotations.
>>> I've searched my dev@ant.apache.org mailing list and Bugzilla and
>>> could not find this particular issue being raised.  Is this a known
>>> issue, is there an associated bug [...]
>>
>> Don't believe it's a known issue. Could be a bug in either junit4  or 
>> Ant - junit4 is supposed to know about suite(), I guess.
>>
>> -J.
>
>
> The test works fine with Ant 1.6.5 and the gump build of junit4.  The 
> junit-dev team was not aware of the problem and did not have any  changes 
> at the time of the failure that seemed to be related to the  issue. 
> Points strongly at something in the Ant changes around 10- Mar-2006, 
> though I did not investigate further since it seemed to be  a known issue 
> to Bill Barker.
>

Yup, it's a known issue.  From JUnitTestRunner.java(line 293):
                if (junit4) {
                    // Let's use it!
                    suite = (Test) junit4TestAdapterClass.getConstructor(new 
Class[] {Class.class}).
                            newInstance(new Object[] {testClass});
                } else {
                    // Use JUnit 3.

                    Method suiteMethod = null;
                    try {
                        // check if there is a suite method
                        suiteMethod = testClass.getMethod("suite", new 
Class[0]);
                    } catch (NoSuchMethodException e) {
                        // no appropriate suite method found. We don't 
report any
                        // error here since it might be perfectly normal.
                    }
                    if (suiteMethod != null) {
                        // if there is a suite method available, then try
                        // to extract the suite from it. If there is an 
error
                        // here it will be caught below and reported.
                        suite = (Test) suiteMethod.invoke(null, new 
Class[0]);

The junit4 class doesn't know or care if there is a 'static Test suite()' 
method on the class.  It looks for Annotations, and then falls back on 
pattern matching method names.  It seems that the suite() method has always 
been an Ant thing.

> Also, ant-contrib-tests started to fail its unit tests on 10-Mar-2006 
> (with no CVS activity for months), however unlike the log4j failure,  it 
> could not be cleaned up by reverting to junit 3.8.1.
>
> There are a lot of other Gump failures that started roughly the same  time 
> (currently 31 failures on http://vmgump.apache.org/gump/public/ 
> project_todos.html), but with a lot of different failure scenarios.    A 
> few of them (for example, http://vmgump.apache.org/gump/public/xml- 
> fop/xml-fop/gump_work/build_xml-fop_xml-fop.html) appear to be due to  a 
> chance in the encoding expectation for Java source files.  That  would 
> point at some change in Gump or Ant at the time unrelated to  junit. 




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

Reply via email to