You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Jesse Glick <je...@sun.com> on 2006/03/20 19:39:04 UTC
Re: "No runnable method" exception during junit task with SVN HEAD
and JUnit 4.
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.
--
jesse.glick@sun.com x22801 netbeans.org ant.apache.org
http://google.com/search?q=e%5E(pi*i)%2B1
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: "No runnable method" exception during junit task with SVN HEAD
and JUnit 4.
Posted by Stefan Bodewig <bo...@apache.org>.
On Mon, 20 Mar 2006, Jesse Glick <je...@sun.com> wrote:
> Don't believe it's a known issue.
I should have used a better subject line 8-(
<http://marc.theaimsgroup.com/?l=ant-dev&m=114217538105956&w=2>
> Could be a bug in either junit4 or Ant - junit4 is supposed to know
> about suite(), I guess.
JUnit 3 never really did, it has always been something the TestRunner
had to resolve, that's why we call it explicitly in the JUnit 3 case.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: "No runnable method" exception during junit task with SVN HEAD and JUnit 4.
Posted by Dominique Devienne <dd...@gmail.com>.
> 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.
I beg to differ. Honoring suite() methods has been supported for a
long time in JUnit's own TestRunners, and even though these were not
part of the "main" package, I've always considered them part of JUnit
itself.
So JUnit4 not supporting them sounds like a regression to me. --DD
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: "No runnable method" exception during junit task with SVN HEAD
and JUnit 4.
Posted by Steve Loughran <st...@apache.org>.
Bill Barker wrote:
> "Curt Arnold" <ca...@apache.org> wrote in message
> news:7749E7D7-EE51-49CC-9137-63206A9433E3@apache.org...
>> 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.
Test suites run in GUI/IDE junit runner too, I use it to generate test
cases from document manifests, running one test per doc:
public class Suite_01_ExtendsTest extends TestCase {
/**
* This is the suite
*
* @return
*/
public static TestSuite suite() {
return
SingleDocumentTestCase.createSuite(Suite_01_ExtendsTest.class,
CddlmConstants.TEST_PACKAGE_CDL_SET_01,
new CdlSmartFrogProcessorFactory());
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: "No runnable method" exception during junit task with SVN HEAD and JUnit 4.
Posted by Bill Barker <wb...@wilshire.com>.
"Curt Arnold" <ca...@apache.org> wrote in message
news:7749E7D7-EE51-49CC-9137-63206A9433E3@apache.org...
>
> 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: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: "No runnable method" exception during junit task with SVN HEAD and JUnit 4.
Posted by Curt Arnold <ca...@apache.org>.
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.
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: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org