Chapter 2. Exploring core JUnit
2.2. Running parameterized tests
2.4. Composing tests with a suite
2.4.1. Composing a suite of test classes
3.1. Introducing the controller component
3.3. Testing exception handling
3.5. Introducing Hamcrest matchers
Chapter 4. Software testing principles
4.1.1. Allowing greater test coverage
4.1.2. Increasing team productivity
4.1.3. Detecting regressions and limiting debugging
4.1.4. Refactoring with confidence
4.1.5. Improving implementation
4.3. Black box versus white box testing
2. Different testing strategies
Chapter 5. Test coverage and development
5.1.1. Introduction to test coverage
5.1.2. Introduction to Cobertura
5.2.1. Public APIs are contracts
5.2.3. Create simple constructors
5.2.4. Follow the Principle of Least Knowledge
5.2.5. Avoid hidden dependencies and global state
5.2.6. Singletons pros and cons
Chapter 6. Coarse-grained testing with stubs
6.2. Stubbing an HTTP connection
6.3. Stubbing the web server’s resources
6.3.1. Setting up the first stub test
6.4.1. Producing a custom URL protocol handler
Chapter 7. Testing with mock objects
7.2. Unit testing with mock objects
7.3. Refactoring with mock objects
7.4. Mocking an HTTP connection
7.4.1. Defining the mock objects
7.4.2. Testing a sample method
7.5. Using mocks as Trojan horses
7.6. Introducing mock frameworks
Chapter 8. In-container testing
8.1. Limitations of standard unit testing
8.2. The mock objects solution
8.4. Comparing stubs, mock objects, and in-container testing
8.4.2. Mock objects pros and cons
3. JUnit and the build process
Chapter 9. Running JUnit tests from Ant
9.3. Introducing and installing Ant
9.4. Ant targets, projects, properties, and tasks
Chapter 10. Running JUnit tests from Maven2
10.1.1. Convention over configuration
10.1.2. Strong dependency management
10.1.3. Maven build lifecycles
10.2. Setting up a Maven project
10.3. Introduction to Maven plug-ins
10.3.1. Maven Compiler plug-in
Chapter 11. Continuous integration tools
11.1. A taste of continuous integration
11.2. CruiseControl to the rescue
11.2.1. Getting started with CruiseControl
11.3. Another neat tool—Hudson
Chapter 12. Presentation-layer testing
12.1. Choosing a testing framework
12.3.2. Testing for a specific web browser
12.3.3. Testing more than one web browser
12.3.4. Creating standalone tests
12.3.5. Navigating the object model
12.3.6. Accessing elements by specific element type
12.3.7. Accessing elements by name versus index
12.3.8. Accessing elements with references
12.3.10. Test failures and exceptions
12.3.11. Application and internet navigation
12.4. Integrating HtmlUnit with Cactus
12.6. Generating Selenium tests
12.8.1. Testing for a specific web browser
12.8.2. Testing multiple browsers
12.8.3. Application and internet navigation
12.8.4. Accessing elements with references
12.8.5. Failing tests with exceptions
12.8.6. Testing forms with Selenium
12.8.7. Testing JavaScript alerts
13.1. Why are Ajax applications difficult to test?
13.2. Testing patterns for Ajax
13.4.1. JavaScript testing with RhinoUnit
13.4.2. JavaScript testing with JsUnit
13.4.4. Writing JsUnit test suites
13.6. Checking best practices with JSLint
13.7. Testing services with HttpClient
13.7.1. Calling an XML service
13.8. Testing Google Web Toolkit applications
13.8.1. Choosing a testing framework for a GWT application
13.8.2. Creating a GWTTestCase manually
Chapter 14. Server-side Java testing with Cactus
14.3. Testing servlets and filters
14.4.1. Revisiting the Administration application
14.4.2. What is JSP unit testing?
14.7. Executing Cactus tests with Ant
14.8. Executing Cactus tests with Maven2x
Chapter 15. Testing JSF applications
15.2. Introducing the sample application
15.3. Typical problems when testing JSF applications
15.4. Strategies for testing JSF applications
15.5. Testing the sample application with JSFUnit
15.6. Using HtmlUnit with JSFUnit
Chapter 16. Testing OSGi components
Chapter 17. Testing database access
17.1. The database unit testing impedance mismatch
17.1.1. Unit tests must exercise code in isolation
17.2.1. The sample application
17.2.2. Setting up DbUnit and running the sample application
17.3. Using datasets to populate the database
17.4. Asserting database state with datasets
17.5. Transforming data using ReplacementDataSet
17.5.1. Using ReplacementDataSet to handle the different IDs issue
17.6. Creating datasets from existing database data
17.7.1. DbUnit and the Template Design Pattern
17.8. Database access testing best practices
17.8.1. Use one database per developer
17.8.2. Make sure the target database is tested
17.8.3. Create complementary tests for loading and storing data
17.8.4. When writing load test cases, cover all the basic scenarios
Chapter 18. Testing JPA-based applications
18.1. Testing multilayered applications
18.3. Preparing the infrastructure
18.4. Testing JPA entities mapping
19.4.1. JUnit-addons assertions package
19.4.2. Unitils’ ReflectionAssert
19.5. Using reflection to bypass encapsulation
Appendix A. Differences between JUnit 3 and JUnit 4
A.3. Annotations and static imports added
A.3.1. @Before and @After annotations
A.3.2. @BeforeClass and @AfterClass annotations
A.5. New assertions and assumptions
Appendix B. Extending the JUnit API with custom runners and matchers
B.1. Introducing the Interceptor pattern
Appendix C. The source code for the book
Appendix D. JUnit IDE integration
D.1. JUnit integration with Eclipse
D.1.2. Setting up Eclipse projects from the source
D.2. Introducing the JUnitMAX Eclipse plug-in
D.3. JUnit integration with NetBeans
D.3.2. Setting up NetBeans projects from the source
Appendix E. Installing software