ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Artur Hefczyc <wisla...@wp.pl>
Subject Re: Anonymous threads in Unittestgen testAll
Date Fri, 18 Jan 2002 10:06:38 GMT
Hello,

Look in comments in line...

> This may be an Ant question, but it could also be a unittestgen
> (http://sf.net/projects/wttools/) question --- I'm hoping this is
This is partialy ant, junit and unittestsgen question. :-)

> something others have already encountered and solved, or that
> there is a config option somewhere to get the effect I need.
Problems comes from test class naming convention I think.

First of all you must note that junit can starts tests only for classes
which extends 'junit.framework.TestCase' class. In your case there is
attempt to start tests on classes which are not 'TestCase' - your inner
classes.
Your inner classes are only helpers for performing tests in your real
'TestCase' implementation and use them directly in test suite is not
correct.
So your 'TestAll.java' should not include in tests suite any class which 
are not 'TestCase' as your inner classes.

To simply solve your problem you should remove from 'TestAll' all 
'suite.addTest(...)' for non 'TestCase' classes.

Additionally it seems to me that you are _not_ using TestAll.class indeed.
It looks like you try to start tests within ant tool. In my sample
build.xml target I added test classes with file mask. In your case this
mask may looks like: 'Test*.class'. So all classes with this mask are included
for tests. But if you use inner classes in your test classes it generates
errors.

The simplest solution for this is changing naming convention for your test classes.
Instead of create names: 'Test*.java' you should name them: '*Test.java'.
So in ant 'junit' target you should also put mask for test classes of
this new form: '*Test.java' and your inner classes will not be included.
Their names will be '*Test$1.java' which is not covered by given mask.

If you can't change naming convention than this is ant problem how to
include only 'TestCase' classes in junit tests. Maybe you can put there
full list of all test classes or more detailed test mask for example
'Test*.java' but not 'Test*$*.java'. How to do it: I don't know.
Maybe some of ANT experts can help you to set this.

> Is there anything I can do about this?  I need to give the unit test
> results to some management types who are not going to really understand
> why the application does not reach a perfect bug-free score in the
> unit tests ;)
Yes, simple answer: Do your tests with proper classes. ;-)

> (ok, I /could/ hand-edit the HTML, but that's really cheating :)
Releasing buggy code is not only problem for your managment but also for you.
So try to do good tests to prevent users from disturbing you because
of poor coded application.

Artur Hefczyc
-- 
Artur Hefczyc
NuTech Solutions:                 artur.hefczyc@nutechsolutions.com.pl
Open Software Developer:          kobit@users.sf.net

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


Mime
View raw message