JUnit in ActionA guide to unit testing Java applications (including J2EE applications) using the JUnit framework and its extensions, this book provides techniques for solving real-world problems such as unit testing legacy applications, writing real tests for real objects, automating tests, testing in isolation, and unit testing J2EE and database applications. Using a sample-driven approach, various unit testing strategies are covered, such as how to unit test EJBs, database applications, JSPs, and Taglibs. Also addressed are testing strategies using freely available open source frameworks and tools, and how to unit test in isolation with Mock Objects. Testing J2EE applications by running tests from inside the container for performing integration unit tests is discussed, as is how to automate unit testing in automated builds (such as Ant and Maven) for performing continuous integration. |
Contents
Exploring JUnit | 17 |
Executing the test methods | 36 |
Testing the DefaultController 46 Adding a handler | 46 |
Copyright | |
20 other sections not shown
Other editions - View all
Common terms and phrases
AdminServlet application assertEquals automatically Automating JUnit black box tests build buildfile Cactus tests called chapter classpath compile components configuration connection container controller create cycle database default define Dyna DynaBean Eclipse environment error example execute extends TestCase Failures framework functional tests getContent handler HttpServletRequest HttpUnit HttpURLConnection implementation import junit.framework In-container testing InputStream integration unit tests interface IOException J2EE jars Java javac Javadoc JBoss JDBC Jetty JNDI JUnit Kent Beck Maven mock objects null OrderLocal package junitbook pathelement platform plugin project.xml public class public void redirector refactoring request RequestHandler response result run the tests server servlets and filters shown in listing software tests source code strategy stubs suite taglibs target task tearDown test classes test coverage test methods test runner Test-Driven Development TestCalculator TestDefaultController Testing in isolation TestResult TestRunner TestSuite throws Exception Unit-testing servlets verify WebClient write unit tests