The Extreme approach to complete Java application testing
Learn Swing user interface testing strategy
Automate testing of components usually thought too hard to test automatically
Practical guide with ready-to-use examples and source code
Based on the authors’ experience developing and testing commercial software
Thorough testing is the basis of good software. Whether we use an agile development methodology such as Extreme Programming, or a more traditional approach, we must test our software at the unit level and application level. The tests must run automatically and cover all aspects of the software.
In this book, the authors draw on more than 20 years of experience to show how automated testing can be applied to a real commercial product.
This book will teach you how to automatically test user interfaces (Swing GUIs), the help system, internationalization, log files, spreadsheets, email, and web services, how to perform tests involving multiple JVMs, and a host of other things. These tests are applied at the module level (unit tests) and at the application level (function tests).
The authors have developed the test processes in the broader context of an Extreme Programming (XP) methodology. However, the testing techniques are certainly not specific to XP, and may be applied within any given development methodology.
Table of Contents
- Swing Extreme Testing
- About the Authors
- About the Reviewers
- What This Book Offers
Roadblocks to Testing
- Roadblock 1: Last on the Waterfall
- Roadblock 2: Testing should be Done by Someone Else
- Roadblock 3: It's Too Hard to Test User Interfaces
- Roadblock 4: It's Too Hard to Develop and Maintain Test Code
- Roadblock 5: It's Too Expensive to Run Tests Often
- Roadblock 6: It's More Interesting to Develop "Real" Code
- Examples and Code
- What You Need For This Book
- Who Is This Book For
- Reader Feedback
- Customer Support
1. What Needs Testing?
- An Example
- What Classes Do We Test?
- Test First—Always!
- What Classes Don't We Test?
- What Methods Need Testing?
- What Methods Don't We Test?
- Invoking Hidden Methods and Constructors
- Unit Test Coverage
- Who Should Implement the Unit Tests?
- What About Legacy Code?
- Where Does Integration Testing Fit In?
- Documentation of Unit Tests
- Testing at the Application Level
- Who Should Implement the Function Tests?
- Automated Test Execution
- A Hierarchy of Tests
- What Language Should Our Tests Be In?
- Is it Really Possible?
- 2. Basics of Unit Testing
- 3. Infrastructure for Testing
- 4. Cyborg—a Better Robot
- 5. Managing and Testing User Messages
- 6. Making Classes Testable with Interfaces
- 7. Exercising UI Components in Tests
- 8. Showing, Finding, and Reading Swing Components
9. Case Study: Testing a 'Save as' Dialog
- The Ikon Do It 'Save as' Dialog
- Outline of the Unit Test
- UI Helper Methods
- Unit Test Infrastructure
- The Unit Tests
10. More Techniques for Testing Swing Components
- Testing with JColorChooser
- Using JFileChooser
- Checking that a JFileChooser has been Set Up Correctly
- Testing the Appearance of a JComponent
- Testing with Frames
- Testing with Lists
- Testing a JTable
- Testing with JMenus
- Testing JPopupMenus
- Combo Boxes
- Progress Bars
- JSlider and JSpinner
- 11. Help!
- 12. Threads
- 13. Logging
- 14. Communication with External Systems
- 15. Embedding User Interface Components in Server-side Classes
- 16. Tests Involving Databases
- 17. Function Tests
- 18. Load Testing
- What is GrandTestAuto?
- Unit Test Coverage
- Advantages of Using GTA
- Getting Started
- Testing Overloaded Methods
- Testing Protected Methods
- Extra Tests
- Classes That Do Not Need Tests
Day-To-Day Use of GrandTestAuto
- Running Just One Level of Test
- Running the Unit Tests for a Single Package
- Running the Unit Tests for a Single Class
- Running the Tests for a Selection of Packages
- Package Name Abbreviation
- Running Tests for a Selection of Classes Within a Single Package
- Running Individual Test Methods
- Running GTA From Ant or CruiseControl
- GTA Parameters
- Distributed Testing Using GTA
- 20. Flaky Tests
- Title: Swing Extreme Testing
- Release date: June 2008
- Publisher(s): Packt Publishing
- ISBN: 9781847194824