Introduction to Java Testing

Print

Request an offer for classroom delivery of this course

Online Registration and Course delivery

Course duration

Course Outline

This Introduction to Java Testing training class introduces the experienced Java programmer to testing and test-driven development practices using JUnit. We work from the basics of JUnit as a tool, to best practices for writing effective and maintainable tests. The course is not strictly a TDD course, but we introduce TDD and take students through an illustrative case study. We discuss the importance of mocking and explore testing techniques using Mockito. Finally we discuss concerns and strategies for testing enterprise components in the Java EE context.

IDE Support: Eclipse Luna: In addition to the primary lab files, an optional overlay is available that adds support for Eclipse Luna. Students can code, build, and test all exercises from within the IDE. See also our orientation to Using Capstone's Eclipse Overlays, and please be advised that this is an optional feature; it is not a separate version of the course, and the course itself does not contain explicit Eclipse-specific lab instructions.

  1. Automated Unit Testing with JUnit
    1. Automated Testing
    2. JUnit and Related Tools
    3. The @Test Annotation
    4. The Assert Class Utility
    5. Test Runners
    6. Lifecycle Methods
    7. Expecting Exceptions
    8. Test Suites
  2. Writing Tests
    1. Test Granularity
    2. Reusing Test Logic
    3. Recording and Comparing Output
    4. Test Isolation
    5. Controlling the Test Environment
    6. Managing Dependencies
    7. Non-Invasive Testing
    8. Designing for Testability
    9. Factories
    10. Testing and Threads
  3. Test-Driven Development
    1. Writing the Test First
    2. The TDD Cycle
    3. Advantages of TDD
    4. Resistance to TDD
    5. A Case Study
  4. Mocking
    1. Mock Objects in Testing
    2. Mock Objects in Test-Driven Development
    3. Static vs. Dynamic Mocks
    4. Stubbing
    5. Verifying
    6. Matching and Capturing
    7. Using a Spy
    8. Partial Mocking
  5. Testing Enterprise Components
    1. Challenges in Java-EE Testing
    2. The Java Naming and Directory Interface
    3. Mocking JNDI
    4. Java-EE Dependency Injection
    5. Testing Persistence Components
    6. Mocking JDBC and JPA
    7. Test Databases
    8. Auto-Rollback
    9. Verifying Transactionality and Cleanup
    10. Web Components
    11. Mocking the Web Container
    12. Asynchronous Messaging
    13. Mocking the JMS Session
    14. Web-Services APIs: JAX-WS and JAX-RS

InterSource Geneva, a premier Information Technology training firm, offers over 400 different courses on server, database and programming technologies, as well as end-user classes for the most popular office, graphics and design applications. We serve clients in Switzerland (Geneva, Lausanne, Bern, Basel, Zurich) and throughout Europe (France, Germany, Austria, Finland, Sweden, England, Netherlands, Spain, etc.).


InterSource offers custom, private courses at client sites, standard public courses in our Geneva classroom, and online training via live Web conference. Training is offered in English and many other languages (Francais, Deutsch, Espanol, Italiano.)


For an overall view of our offerings, please visit us at www.intersource.ch.