This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
Also, JUnit does have "test fixtures." It just doesn't call it that in the code. A test fixture is the context the test executes in. The objects are created in a setUp method and available during your test.
What do you mean by is JUnit automated? In the program I used JUnit with, I put JUnit in my Ant build. Then whenever I did a build, it would compile and test as a part of that build. Is this what you mean? There are a few different ways to run JUnit. You can run it through the awt graphical interface (but I don't think anybody uses this anymore) or the swing GUI which I think everybody uses when they use a GUI. When you run the GUI it shows a status bar across the display. When the status bar is done, if it's green it's clean. If it's red there's a problem. It should tell you the line where your assertion failed. You can also run your JUnit tests from a textual interface. You can create reports too from your Ant builds through a junitreport Ant task. Hope this helped - Greg
Greg Ostravich - SCPJ2
author & internet detective
Pradeep, Yes, code is required. The idea is to get your test cases into code form. However, the boilerplate code is always the same - so cut and paste works great. Eclipse's code generation works well too.
Originally posted by Jeanne Boyarsky: so cut and paste works great.
Regarding this, I'd like to mention that test code should be kept clean just like the production code. If you don't refactor your test code, think about how difficult it will get to change it after some 2000 tests...