Automating EJB Unit Testing
Enterprise Java Beans, or EJBs, cannot be tested on their own as can plain Java classes. There are additional steps to deploy them to an EJB container before they can be tested. This means that our testing process must include the additional process of deployment and re-deployment of EJBs. The deployment must be automated as well.
Black Box Web Testing with HttpUnit
Automated software tests are crucial for IT projects. They enable continuous modifications to an existing code base without the fear of damaging existing functionality. They are executed at will and don't carry the costs and inconsistencies associated with manual tests.
Debugging with FindBugs
One of the problems with code quality tools is that they tend to overwhelm developers with problems that aren't really problems -- that is, false positives. When false positives occur, developers learn to ignore the output or abandon the tool altogether. FindBugs aims to reduce the number of false positives it reports. Unlike other static analysis tools, FindBugs doesn't focus on style or formatting; it specifically tries to find real bugs or potential performance problems.
Diagnosing Java Code : Designing "testable" applications
In this installment of Diagnosing Java Code, takes a break from examining specific bug patterns and opts instead to discuss the issues involved in designing software...
Diagnosing Java Code: The Fictitious Implementation bug pattern, Part 2
In the last installment of Diagnosing Java Code, we saw that it is possible to implement a Java interface without actually meeting its intended semantics. This second article in a two-part series demonstrates two handy tools to fight...
Log4j delivers control over logging
The open source log4j API for Java offers fast, efficient log services. This article describes the log4j API, its unique features, and its design rationale
Robust event logging with Syslog
In this article, Nate Sammons introduces Syslog, a robust logging system that divorces the act of logging an event from the handling of that event. You'll learn how to easily integrate the Syslog package into your Java programs and how to leverage Syslog as an integral part of new system development.
Static Analysis with PMD
PMD is a utility for finding problems in Java code. PMD does
this using static analysis; that is, analyzing the source code
without actually running the program. PMD comes with a number
of ready-to-run rules that you can run on your own source code
to find unused variables, unnecessary object creation, empty
catch blocks, and so forth. You can also write your own rules
to enforce coding practices specific to your organization. For
example, if you're doing EJB programming, you could write a PMD
rule that would flag any creation of Thread or Socket objects.
If you're feeling generous, you can donate that rule back to
PMD for anyone to use.
Test infect your Enterprise JavaBeans
Software can never be tested sufficiently, and testing usually starts too late, particularly for J2EE applications. Since components often behave differently when they are alone than when they have been assembled, testing each component individually before two or more components are joined together ensures each piece of code in a J2EE application will work as it was designed to do. Then, if an error occurs in the application, the developer knows the application's assembly may be the cause. This article presents unit testing techniques and how to apply unit testing to Enterprise JavaBeans (EJBs).
Test networked code the easy way
Networked code proves difficult to test thoroughly because test suites work best as standalone processes unreliant on other servers. In this article, Nelson Minar describes two techniques for unit testing network code. First, he proposes that you design your code such that as much logic as possible works independently from the network. Second, he suggests using Java's protocol handler classes to simulate network connections without actually using the network. By employing these principles, you'll produce easily tested network software. This article includes sample code for a Java protocol handler, as well as the PrintRSS demo program and a test suite for PrintRSS that demonstrates testing concepts.
Understanding Classloaders: log4j in a J2EE Environment
A previous article of mine explained the basics of log4j. log4j is an open source logging tool developed under the Jakarta Apache project. The previous article demonstrated how to use log4j in a strictly JSP/servlet environment, which forms half of the whole J2EE world. The other half, EJBs, requires a subtler way of handling your log4j code and configuration. This article will show you why this is the case and how to go about it.
Zap Java bugs before they bite with PMD
Even with just its built-in rules (which are quite extensive), PMD will almost certainly find some real problems in your code. Some of them will be minor, but some won't be. PMD, an open source static analysis tool, can be a worthwhile addition to your bug-zapping arsenal. Elliotte Rusty Harold explains how to use PMD's built-in rules and your own custom rule sets to improve the quality of your Java code.