Menu

#97 Generate Test Case from Class

open
nobody
Other (46)
5
2002-08-07
2002-08-07
No

(This is essentially the inverse of Feature Request
525996.)

For beginning students with no Java experience, it
could be very useful to be able to automatically
generate a simple test case class given an existing
class. The process would involve displaying some sort
of dialog which would allow users to specify sample
inputs and expected outputs for any non-private method
in the class being tested. (Strings and other
primitives wouldn't be a problem; perhaps for objects
users could just enter the appropriate code as if in
the Interactions pane.) DrJava would then generate
code for the test case using several test methods which
each called assertEquals.

We wouldn't care about making this TOO robust, because
once students get some experience, they should learn to
write the test cases themselves. But this sort of tool
would allow teachers to introduce unit testing from the
very beginning, without having to explain any of the
details needed for writing a test (eg. import
statements, inheritence, public, etc). And as long as
the tool also put in some reasonable comments, it could
be an example of good coding style, as well.

Discussion

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.