Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Testing and the fly likes Testing the application with Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Testing the application with "public static void main" method" Watch "Testing the application with "public static void main" method" New topic
Author

Testing the application with "public static void main" method

Rogerio Kioshi
Ranch Hand

Joined: Apr 12, 2005
Posts: 689
Is it too wrong to test an application with a bunch of classes, each one with its "public static void main" method?


SCEA 5 (part 1), SCBCD, SCWCD, SCJP, CLP, CLS
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31057
    
232

Why does each one have a main method?

I don't think it is bad to test a main method if it exists "in the real code." Like when developing a command line utility. But I wouldn't add a main method for the purposes of testing. That's what JUnit is for .


[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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Testing the application with "public static void main" method