Content area

Abstract

Summary - Extreme Programming's rise in popularity among the Java community has prompted more development teams to use JUnit: a simple test framework for building and executing unit tests. Like any toolkit, JUnit can be used effectively and ineffectively. In this article, Andy Schneider discusses good and bad ways to use JUnit and provides practical recommendations for its use by development teams. In addition, he explains simple mechanisms to support: Automatic construction of composite tests</li> Multithreaded test cases</li> This article assumes some familiarity with JUnit. (4,000 words)

When faced with unit testing, many teams end up producing some kind of testing framework. JUnit, available as open source, eliminates this onerous task by providing a ready-made framework for unit testing. JUnit, best used as an integral part of a development testing regime, provides a mechanism that developers can use to consistently write and execute tests. So, what are the JUnit best practices?

Using JUnit to develop robust tests takes some practice (as does writing tests). This article contains a number of techniques for improving your tests' usefulness. Those techniques range from avoiding basic mistakes (such as not using setUp()) to more design- level issues (avoiding intertest coupling). I've covered some basic ideas to help you use JUnit to test parts of your UI or Web application. I've also shown how to build an automated test suite that removes the overhead of maintaining hand-coded test suites and a mechanism for reducing the effort of developing multithreaded JUnit test cases.

Details

Identifier / keyword
Title
JUnit best practices; Techniques for building resilient, relocatable, multithreaded JUnit tests
Publication title
JavaWorld; San Francisco
Pages
1
Number of pages
0
Publication year
2001
Publication date
Jan 3, 2001
Publisher
Foundry
Place of publication
San Francisco
Country of publication
United States
ISSN
10918906
Source type
Trade Journal
Language of publication
English
Document type
PERIODICAL
ProQuest document ID
237187696
Document URL
https://www.proquest.com/trade-journals/junit-best-practices-techniques-building/docview/237187696/se-2?accountid=208611
Copyright
Copyright Web Publishing, Inc. Jan 3, 2001
Last updated
2024-08-25
Database
ProQuest One Academic