JUnit Section Index
How can I use JUnit to test J2EE/EJB applications?
Check out Jeff Schnitzer's JUnitEE package and the
Wiki EJB Unit Testing page.
What debugging tools exist for Java?
Check out logging packages like
log4j and unit testing frameworks like
JUnit.
Check out static analysis tools such as
Metamata's
Audit
and
Metrics
products.
For dyanmic analysis and manipulati...more
How do I run setup and tear-down code once for all my tests?
Wrap the top level test suite in a subclass of TestSetup.
The following is a sample AllTests.suite() method:
public static Test suite() {
TestSuite suite = new TestSuite();
...more
How do I test a method that returns void?
Test an expected side-effect of the method. This may involve querying an instance
variable or passing in a mock object to collect the results of the method. The latter
is sometimes useful to a...more
How do I implement a test case for a thrown exception?
How do I implement a test case for a thrown exception?
What is JUnitEE?
JUnitEE is a simple extension to JUnit which allows standard test cases to be run from within a J2EE application server. It is composed primarily of a servlet which outputs the test results as htm...more
What do all of these XP (eXtreme Programming) acronyms mean?
Check out the
XP Glossary.
When I use HttpUnit, I get a runtime exception - HttpUnit is looking for something called org.w3c.xml.Tidy. Where is this?
HttpUnit uses Tidy to parse HTML. You can download Tidy here.
How can I use JUnit to test a method that takes a complex parameter - like an HttpServletRequest?
Say you want to test this method:
public Vector getEmployeeList(HttpServletRequest req) {
Vector list = new Vector();
String department = req.getParameter("departmentID");
...more
How can I use JUnit to ensure that my servlets/JSP are producing valid HTML?
There's the traditional, brute force way - write a JUnit test case that opens a HttpURLConnection to your servlet, reads the content, and does various String.indexOf() and String.subString() opera...more
What's an example of a simple JUnit test case?
Say you've got a little method, getName(String path) that parses a file name from a file path. You can write a JUnit test class to feed it a path and ensure that the results are what you expected...more
What are the differences between the different versions of JUnit?
The Wiki site contains a
summary of changes to JUnit page.
Where can I find unit testing frameworks similar to JUnit for other languages?
From the
XP Software page.
Where can I get the latest version of JUnit?
From the
XP Software page.
What is JUnit?
JUnit is a free, open source Java framework that makes unit testing easier and more effective. Complete details are available at JUnit. There's also a lot of discussion of this framework on C2's...more