List of Figures

Chapter 1. JUnit jump-start

Figure 1.1. Execution of the JUnit distribution sample tests using the text test runner

Figure 1.2. Execution of the first JUnit test CalculatorTest using the text test runner

Chapter 2. Exploring core JUnit

Figure 2.1. JUnit’s green bar, shown in Eclipse

Figure 2.2. Running a suite of suites in Eclipse

Chapter 3. Mastering JUnit

Figure 3.1. The screen on the left shows the stack trace from the execution of the test without using Hamcrest, and the one on the right shows the same thing using Hamcrest.

Figure 3.2. A separate-but-equal filing system keeps tests in the same package but in different directories.

Chapter 4. Software testing principles

Figure 4.1. The five types of tests

Figure 4.2. A JMeter throughput graph

Figure 4.3. Interaction among the three unit test types: functional, integration, and logic

Chapter 5. Test coverage and development

Figure 5.1. Partial test coverage with black box tests

Figure 5.2. Complete test coverage using white box tests

Figure 5.3. A Cobertura code-coverage report

Figure 5.4. Class code coverage with Cobertura

Figure 5.5. A typical application development lifecycle using the continuous integration principle

Figure 5.6. The different types of tests performed on each platform of the development cycle

Chapter 6. Coarse-grained testing with stubs

Figure 6.1. The sample application opens an HTTP connection to a remote web resource. The web resource is the “real code” in the stub definition.

Figure 6.2. Adding a test case and replacing the real web resource with a stub

Figure 6.3. Testing the JettySample class in a browser

Figure 6.4. Result of the first working test using a Jetty stub. JUnit starts the server before the first test, and the server shuts itself down after the last test.

Figure 6.5. Result of executing TestWebClient1 (which uses the StubHttpURLConnection)

Chapter 7. Testing with mock objects

Figure 7.1. In this simple bank account example, we use a mock object to test an account transfer method.

Figure 7.2. The sample HTTP application before introducing the test

Figure 7.3. The steps involved in a test using mock objects

Figure 7.4. Running TestWebClient with the new close expectation

Figure 7.5. Working WebClient that closes the input stream

Chapter 8. In-container testing

Figure 8.1. Lifecycle of a typical in-container test

Chapter 9. Running JUnit tests from Ant

Figure 9.1. Running the build file from the command line

Figure 9.2. Ant output with Ivy at work

Figure 9.3. Ant JUnit HTML report

Chapter 10. Running JUnit tests from Maven2

Figure 10.1. Directory structure after creating the project

Figure 10.2. Maven produces nice website documentation for the project.

Figure 10.3. Execution of JUnit tests with Maven2

Figure 10.4. HTML report from the Maven Surefire Report plug-in

Chapter 11. Continuous integration tools

Figure 11.1. Continuous integration scheme

Figure 11.2. Executing CruiseControl for the first time

Figure 11.3. CruiseControl control panel in the browser

Figure 11.4. Email notification from CruiseControl server

Figure 11.5. Hudson initial startup screen

Figure 11.6. Hudson configuration screen

Figure 11.7. Job-configuration screen in Hudson

Figure 11.8. Hudson job home page

Figure 11.9. Hudson build results

Chapter 12. Presentation-layer testing

Figure 12.1. Sample form and alert

Figure 12.2. The main Selenium IDE window

Figure 12.3. Selenium IDE context menu

Chapter 13. Ajax testing

Figure 13.1. New pages are downloaded for each interaction in a web-classic application.

Figure 13.2. Relevant portions of a page downloaded for each Ajax web application interaction

Figure 13.3. A simple Ajax form

Figure 13.4. The JsUnit test runner

Figure 13.5. Running StockWatcher in hosted mode

Figure 13.6. Running a test

Chapter 14. Server-side Java testing with Cactus

Figure 14.1. Lifecycle of a Cactus test

Figure 14.2. The sample Administration application. We use it as a base sample in this chapter to see how to unit test servlets, filters, JSPs, taglibs, and database applications.

Figure 14.3. Strategy to unit test JSPs with Cactus

Figure 14.4. XML result in the browser from Cactus tests

Chapter 15. Testing JSF applications

Figure 15.1. Architectural overview of a JSF application

Figure 15.2. The two screens of the MusicStore application

Figure 15.3. Results from the execution of our JSFUnit tests in a browser

Chapter 16. Testing OSGi components

Figure 16.1. Lifecycle phases of an OSGi bundle

Figure 16.2. Executing the JUnit tests with the GUI runner

Chapter 18. Testing JPA-based applications

Figure 18.1. Class diagram of the testing infrastructure

Appendix B. Extending the JUnit API with custom runners and matchers

Figure B.1. The JUnit test runner shows that it takes 4.375 seconds to execute the whole test (with @Before and @After methods).

Figure B.2. Results from executing the tests, including the custom matcher

Appendix C. The source code for the book

Figure C.1. Directory structure for the source code, shown here in Windows Explorer. (Note that the directory and file icons are decorated by the TortoiseSVN client.)

Appendix D. JUnit IDE integration

Figure D.1. Eclipse workspace when all the book projects have been imported

Figure D.2. Running the TestWebClient1 test case in Eclipse using the built-in JUnit plug-in

Figure D.3. Adding the JDK ivy-[version].jar to the Ant classpath in Eclipse

Figure D.4. Eclipse displays the Ant view.

Figure D.5. The Ant view displays all the Ant targets found in build.xml.

Figure D.6. Result of executing the compile Ant target for the ch09-ant project

Figure D.7. Introducing an error in our test case causes JUnitMAX to execute the tests and report the error as a red marker at the beginning of the line.

Figure D.8. Our test passes when we fix the error and save the file.

Figure D.9. Import Eclipse projects into NetBeans.

Figure D.10. Compilation problems with NetBeans

Figure D.11. Resolved source folders

Figure D.12. Result from executing a sample JUnit test case

Figure D.13. Results from executing the Ant script in NetBeans

Appendix E. Installing software

Figure E.1. Setting up a JRE in Eclipse for HtmlUnit

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.37.20