You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by maarten roosendaal <mr...@yahoo.com> on 2006/01/16 09:13:53 UTC

problem running ant/junit from Eclipse

Hi,

I have create a MultiThreadedTestCase based on the one
descibed in
http://www.javaworld.com/javaworld/jw-12-2000/jw-1221-junit.html.
It uses an Innerclass that extends TestCaseRunnable
that implements Runnable.

When i run the test from Eclipse it works fine. When i
run the test from an ANT build-file it fails with the
following message:
Class
nl.test.threadsafety.TestDatabaseLocking$CounterThread
has no public constructor TestCase(String name) or
TestCase()

junit.framework.AssertionFailedError: Class
nl.ictu.spg.test.threadsafety.TestDatabaseLocking$CounterThread
has no public constructor TestCase(String name) or
TestCase()

What could cause this problem when simply running the
unittest WITHOUT ANT is working fine? I know a
TestClass should extend the TestCase-class but when
implementing Runnable you have a problem with the
run(). But this does not seem to be the problem
otherwise the problem would occur in both instances.

Hope someone has an idea.

Thanks,
Maarten

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: problem running ant/junit from Eclipse

Posted by Steve Loughran <st...@hpl.hp.com>.
maarten roosendaal wrote:
> Thanks, i changed the pattern to exclude innerclasses:
> <fileset dir="${build.home.classes}"
> includes="**/Test*" excludes="**/Test*$$*" />
> 
> Maarten

yeah, that would do it.

I always give my tests the same ending, so  *Test.class catches it.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: problem running ant/junit from Eclipse

Posted by maarten roosendaal <mr...@yahoo.com>.
Thanks, i changed the pattern to exclude innerclasses:
<fileset dir="${build.home.classes}"
includes="**/Test*" excludes="**/Test*$$*" />

Maarten

--- Steve Loughran <st...@apache.org> wrote:

> maarten roosendaal wrote:
> > Hi,
> > 
> > I have create a MultiThreadedTestCase based on the
> one
> > descibed in
> >
>
http://www.javaworld.com/javaworld/jw-12-2000/jw-1221-junit.html.
> > It uses an Innerclass that extends
> TestCaseRunnable
> > that implements Runnable.
> > 
> > When i run the test from Eclipse it works fine.
> When i
> > run the test from an ANT build-file it fails with
> the
> > following message:
> > Class
> >
>
nl.test.threadsafety.TestDatabaseLocking$CounterThread
> > has no public constructor TestCase(String name) or
> > TestCase()
> > 
> > junit.framework.AssertionFailedError: Class
> >
>
nl.ictu.spg.test.threadsafety.TestDatabaseLocking$CounterThread
> > has no public constructor TestCase(String name) or
> > TestCase()
> > 
> > What could cause this problem when simply running
> the
> > unittest WITHOUT ANT is working fine? I know a
> > TestClass should extend the TestCase-class but
> when
> > implementing Runnable you have a problem with the
> > run(). But this does not seem to be the problem
> > otherwise the problem would occur in both
> instances.
> > 
> 
> 1. We don't know how eclipse runs its tests. It
> probably introspects to 
> only run everything that extends TestCase
> 
> 2. I'd look at your pattern of selecting which tests
> to run. Junit 
> appears to have been handed the thread to turn into
> a test case, which 
> obviously fails as it isnt one.
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: problem running ant/junit from Eclipse

Posted by Steve Loughran <st...@apache.org>.
maarten roosendaal wrote:
> Hi,
> 
> I have create a MultiThreadedTestCase based on the one
> descibed in
> http://www.javaworld.com/javaworld/jw-12-2000/jw-1221-junit.html.
> It uses an Innerclass that extends TestCaseRunnable
> that implements Runnable.
> 
> When i run the test from Eclipse it works fine. When i
> run the test from an ANT build-file it fails with the
> following message:
> Class
> nl.test.threadsafety.TestDatabaseLocking$CounterThread
> has no public constructor TestCase(String name) or
> TestCase()
> 
> junit.framework.AssertionFailedError: Class
> nl.ictu.spg.test.threadsafety.TestDatabaseLocking$CounterThread
> has no public constructor TestCase(String name) or
> TestCase()
> 
> What could cause this problem when simply running the
> unittest WITHOUT ANT is working fine? I know a
> TestClass should extend the TestCase-class but when
> implementing Runnable you have a problem with the
> run(). But this does not seem to be the problem
> otherwise the problem would occur in both instances.
> 

1. We don't know how eclipse runs its tests. It probably introspects to 
only run everything that extends TestCase

2. I'd look at your pattern of selecting which tests to run. Junit 
appears to have been handed the thread to turn into a test case, which 
obviously fails as it isnt one.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org