Hand-rolled mocks made easy
Unit testing is something we all need to do, but getting good code coverage can be a daunting task. In this article, Gary Tong focuses on one of the basic elements of unit tests: mock objects. Using a hybrid static/dynamic approach, he shows how flexible, useful mock objects can be written in a matter of minutes.
Gary Tong, July 2006

Fit for analysts and developers
Do you think automated user acceptance testing is a cool idea, but impossible or not worth doing? Have you been bogged down by the traditional record/script/replay approaches and unable to automate until the code is complete? This article will show you how the Framework for Integrated Test (Fit) makes it easy to overcome these challenges and practice test-first design from the user perspective.
Narayanan Jayaratchagan, June 2006

Test-first development with FitNesse
This article describes how the open source wiki FitNesse can be used to implement a real test-first development process by bringing customer, requirements engineer, developer, and tester together. Requirements get more precise, change is minimal, and test data is removed from the JUnit tests, making them much cleaner and easier to maintain.
Stephan Wiesner, February 2006

Add Zing to your unit tests
Unit testing has become an inseparable part of the software development lifecycle. Many open source tools and frameworks assist developers in writing unit tests. However, little has been done to help developers write generic test cases, reduce coding effort, and generate maintainable unit test cases. Generally, developers write numerous test methods to test different data scenarios for a given method. They also must handle database states before every unit test case runs to ensure consistency in test results. Creating a test framework that facilitates the writing of generic and configurable unit test cases and also integrates with multiple open source testing tools and frameworks can solve these issues. This article discusses how to create such a test framework.
Tanmay Ambre and Abhijeet Kesarkar, December 2005

Don't sweat unit tests
By hiding the services your code depends on behind interfaces and using jMock to mock out those interfaces, you can unit test anything. In this article, Graham King shows how to build a simple example application by testing first. He starts with simple, easy-to-test methods, then progresses to ones that require external infrastructure support. He shows how working with interfaces and using mock objects makes testing easy.
Graham King, November 2005

Exception management and error tracking in J2EE
Think back on your last J2EE project. Did you encounter situations when errors were never logged—or logged more than once? Did you spend countless hours tracking down a bug, whose real cause was that someone swallowed an exception somewhere? Did your users see a stack trace? If so, chances are, you might need a common strategy for exception management and some complementing code. This article provides the basis for developing a set of policies along with a supporting framework for error handling in the J2EE world.
Kåre Kjelstrøm and Jens Schjærff Byager, July 2005

JMeter tips
Developing a load-testing script using JMeter is not difficult, as JMeter provides a rich set of elements and a drag-and-drop-style GUI. However, creating a test script that closely models the real loads is often considered difficult. One of the reasons is that some of the parameters critical to test quality are confusing. This article solves some of the puzzles for you, and, as a related topic, presents guidelines for response-time requirements.
Chi-chang Kung, July 2005

Build, deploy, and test EJB components in just a few seconds
Wouldn't life be easier if you could build, deploy, and test Enterprise JavaBeans (EJB) components in just a few seconds? This article shows you how to simplify the EJB development cycle. Author Nader Aeinechi shows how to easily create input data for your JUnit tests with XStream. He explains the benefits of running your tests with an embedded EJB container called OpenEJB and how those same tests can be run unmodified on your full-featured production EJB container.
Nader Aeinehchi, June 2005

TestNG: The next generation of unit testing
Everyone knows JUnit, the Java unit-testing framework. JUnit has some annoying specificities that make it unsuitable for complex unit testing involving grouping, asynchronous, and parallel testing. This article introduces TestNG, an alternative testing framework targeted at J2SE 5.0.
Thierry Janaudy, April 2005

Patch an exception-handling framework
This article describes the Patch framework, an exception-handling framework for Java programs. It forces exception handling to remain outside a system's main business logic. In addition, that business logic is not affected when the way an exception is handled changes.
Niranjan R. Kamath, March 2005

Should we be doing more automated testing?
To help developers decide whether they should be doing more automated testing, Ben Teese presents two questions in this article: Are developers being realistic about the testing they will complete on their applications? And when does automatic testing make sense for their applications?
Ben Teese, March 2005

LISA smiles on J2EE app testers
LISA (Load-bearing Internet-based Simulator Application) from iTKO is a tough slope to ascend; the tool is nothing less than a development environment for building tests, and it takes a bit of time to get used to LISA's way of doing things. The view from the top, though, is worth the effort—LISA provides remarkable breadth in J2EE regression testing.
Rick Grehan, January 2005

Getting started with test-driven development
In this article, an excerpt from Test-Driven Development: A J2EE Example (Apress, 2004), author Thomas Hammell helps you select the right tools for getting started with test-driven development (TDD).
Thomas Hammell, With Russell Gold and Tom Snyder, December 2004

A lightweight nonintrusive EJB testing framework
This article presents a simple, easy-to-deploy framework that enables fine-grained tests to be run on the container, making it possible to develop and maintain Enterprise JavaBeans components using a test-driven development (TDD) process.
Phil Zoio, November 2004

Automate GUI tests for Swing applications
Automation is necessary for frequent and consistent testing, which is the foundation of agile development. However, acceptance tests of GUI applications are not always easy to automate. This article explains a simple way of automating Java Swing application acceptance tests, starting from Swing components' unit tests and extending them to acceptance tests without human intervention.
Ichiro Suzuki, November 2004

All

Let's talk about exceptions ...
How do you handle exceptions? Do you think upfront about the type of exceptions that you want to catch or do you just let the outside world handle it?

-- Jeroen van Bergen in JW Blogs

Newsletter sign-up

Sign up for our technology specific newsletters.

Enterprise Java
View all newsletters

Email Address: