aspose file tools*
The moose likes Testing and the fly likes Junit test case generation using ant Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Junit test case generation using ant" Watch "Junit test case generation using ant" New topic
Author

Junit test case generation using ant

mohit bahl
Ranch Hand

Joined: Mar 22, 2006
Posts: 48
Hi

i am looking for reasonably good approach to auto-generate JUnit test cases for my business and dao layer classes. I need to doo this using an ant task.

Thanks in advance
mohit


to err is human, but the company policy doesn't allow it!
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30762
    
156

Mohit,
What are you trying to generate? Test stubs? Throwing bad input to make sure the code blows up?

Good tests require human involvement. An automatic test generator can't test your code is working as expected as it doesn't know what the code should do.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
mohit bahl
Ranch Hand

Joined: Mar 22, 2006
Posts: 48
I absolutely agree with you about manual intervention in testing.

But my intentions are only to validate that the function calls are returning what they were suppose to and in case there is some code change done by some other developer then its impact can be known with the help of such test cases and can be caught at the time of an integrated build.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30762
    
156

Originally posted by mohit bahl:
But my intentions are only to validate that the function calls are returning what they were suppose to

How do you know what they are supposed to return.



and in case there is some code change done by some other developer then its impact can be known with the help of such test cases and can be caught at the time of an integrated build.

This is what the tools claiming to generate tests do. They provide regression tests assuming the current implementation is correct. I haven't found an implementation that I like though. They tend to either not generate good coverage (focusing on throwing bad input values at the function) or are so brittle that they break for normal low level implementation changes.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Junit test case generation using ant