This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Testing and the fly likes to use junit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "to use junit" Watch "to use junit" New topic
Author

to use junit

venkataramana raju
Greenhorn

Joined: Sep 11, 2005
Posts: 28
hello
i am new for this forum as well as for junit

can anybody tell me how to write junit test cases(i mean
i have some java files , and i want to write junit tests with in
separate package, now when ever i run my java files automaticly those
tests should run)
to do this what code i have to place in my java files???

thanks
raju
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by venkataramana raju:
can anybody tell me how to write junit test cases(i mean i have some java files , and i want to write junit tests with in separate package, now when ever i run my java files automaticly those tests should run) to do this what code i have to place in my java files???

Sorry, JUnit doesn't work that way. You'll have to run your JUnit tests, not the production code.

It might help in getting started if you read the couple of short articles at
junit.sourceforge.net. Also, if you're using the Eclipse IDE, there's a couple of tutorials on the topic here and here.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: to use junit
 
Similar Threads
TestNg or Junit
cancelling junit tests?
How important is testing our test cases ?
what I can do with junit ??
IntelliJ switch between junit and testng