JUnit in Action (Paperback)

Vincent Massol, Ted Husted

  • 出版商: Manning
  • 出版日期: 2003-10-01
  • 售價: $1,550
  • 貴賓價: 9.5$1,473
  • 語言: 英文
  • 頁數: 384
  • 裝訂: Paperback
  • ISBN: 1930110995
  • ISBN-13: 9781930110991
  • 相關分類: Java 相關技術JUnit
  • 已過版

買這商品的人也買了...

相關主題

商品描述

 

Summary

Developers in the know are switching to a new testing strategy - unit testing - which interleaves coding and testing in an integrated way. This has proven to be a powerful combination that results in better designed software with fewer defects and faster delivery cycles.

JUnit in Action shows you how to benefit from this strategy using the popular open source testing framework, JUnit. It's a no fluff discussion of unit testing techniques and best practices. It gives examples of tough situations such as how to unit test EJBs, database applications, JSPs and Taglibs. It discusses unit testing of J2EE applications, and shows how to test in automated builds.

What's Inside

  • Testing in isolation with mock objects
  • In-container testing with Cactus
  • Automated builds with Ant and Maven
  • Unit testing from within Eclipse
  • Test Driven Development principles
  • Unit testing
    • Java apps
    • Servlets
    • JSP
    • Taglibs
    • Filters
    • EJB
    • DB apps

More Information

If you have questions about JUnit in Action, please use the following mailing lists or forums:

Please note that for mailing lists, you'll need to subscribe to the list before being able to post messages.

Table of Contents

PART I JUNIT DISTILLED

Chapter 1: JUnit jumpstart

1.1 Proving it works
1.2 Starting from scratch
1.3 Understanding unit testing frameworks
1.4 Setting up JUnit
1.5 Testing with JUnit
1.6 Summary

Chapter 2: Exploring JUnit

2.1 Exploring core JUnit
2.2 Launching tests with test runners
2.3 Composing tests with TestSuite
2.4 Collecting parameters with TestResult
2.5 Observing results with TestListener
2.6 Working with TestCase
2.7 Stepping through TestCalculator
2.8 Summary

Chapter 3 Sampling JUnit

3.1 Introducing the controller component
3.2 Let's test it!
3.3 Testing exception-handling
3.4 Setting up a project for testing
3.5 Summary

Chapter 4 Examining software tests

4.1 Why we need unit tests
4.2 Kinds of tests
4.3 Determining how good tests are
4.4 Test-driven development
4.5 Summary

Chapter 5 Automating JUnit

5.1 A day in the life
5.2 Running tests from Ant
5.3 Running tests from Maven
5.4 Running tests from Eclipse
5.5 Summary

PART II TESTING STRATEGIES

Chapter 6 Coarse-grained testing with stubs

6.1 Introducing Stubs
6.2 Practicing on an HTTP Connection sample
6.3 Stubbing the web server's resources
6.4 Stubbing the connection
6.5 Summary

Chapter 7 Testing in isolation with mock objects

7.1 Introducing mock objects
7.2 Mock tasting's simple example
7.3 Using mock objects as a refactoring technique
7.4 Practicing on a HTTP connection sample
7.5 Using mocks as Trojan horses
7.6 Deciding when to use mock objects
7.7 Summary

Chapter 8 In-container testing with Cactus

8.1 The problem with unit-testing components
8.2 Testing components using mock objects
8.3 Integration unit tests
8.4 Introducing Cactus
8.5 Testing components using Cactus
8.6 How Cactus works
8.7 Summary

PART III TESTING COMPONENTS

Chapter 9 Unit-testing servlets and filters

9.1 Presenting the Administration application
9.2 Writing servlet tests with Cactus
9.3 Testing servlets with mock objects
9.4 Writing filter tests with Cactus
9.5 When to use Cactus, and when to use mock objects
9.6 Summary

Chapter 10 Unit-testing JSPs and taglibs

10.1 Revisiting the Administration application
10.2 JSP unit testing
10.3 Unit-testing a JSP in isolation with Cactus
10.4 Unit-testing taglibs with Cactus
10.5 Unit-testing taglibs with mock objects
10.6 When to use mock objects, and when to use Cactus
10.7 Summary

Chapter 11 Unit-testing database applications

11.1 Database unit testing
11.2 Testing business logic in isolation from the database
11.3 Testing persistence code in isolation from the database
11.4 Writing database integration unit tests
11.5 Running the Cactus test using Ant
11.6 Tuning for build performance
11.7 Overall database unit-testing strategy
11.8 Summary

Chapter 12 Unit-testing EJBs

12.1 Defining a sample EJB application
12.2 Using a façade strategy
12.3 Unit testing JNDI code using mock objects
12.4 Unit-testing session beans
12.5 Using mock objects to test message-driven beans
12.6 Using mock objects to test entity beans
12.7 Choosing the right mock object strategy
12.8 Using integration unit tests
12.9 Using JUnit and remote calls
12.10 Using Cactus
12.11 Summary

Appendix A The source code

Appendix B Eclipse quick start