Introduction to Java Testing
This course 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.
Public Classes: Delivered live online via WebEx and guaranteed to run . Join from anywhere!
Private Classes: Delivered at your offices , or any other location of your choice.
- Build unit tests for Java classes using JUnit.
- Write effective tests, and design classes for testability.
- Use Hamcrest matchers effectively, and build custom matchers as needed.
- Understand test-driven development (TDD) and use dynamic mocking to support isolated testing.
- Develop effective mocking and testing strategies for Java-EE components.
- Automated Unit Testing with JUnit
- Automated Testing
- JUnit and Related Tools
- The @Test Annotation
- The Assert Class Utility
- Test Runners
- Lifecycle Methods
- Expecting Exceptions
- Test Suites
- Writing Tests
- Test Granularity
- Reusing Test Logic
- Recording and Comparing Output
- Test Isolation
- Controlling the Test Environment
- Managing Dependencies
- Non-Invasive Testing
- Designing for Testability
- Testing and Threads
- The Hamcrest Library
- Advantages of Matchers
- Built-In Matchers
- Collection, Bean, and XPath Matchers
- Aggregating Matchers
- Functional-Friendly Matchers
- Test-Driven Development
- Writing the Test First
- The TDD Cycle
- Advantages of TDD
- Resistance to TDD
- A Case Study
- Mock Objects in Testing
- Mock Objects in Test-Driven Development
- Static vs. Dynamic Mocks
- Matching and Capturing
- Using a Spy
- Partial Mocking
- Testing Enterprise Components
- Challenges in Java-EE Testing
- The Java Naming and Directory Interface
- Mocking JNDI
- Java-EE Dependency Injection
- Testing Persistence Components
- Mocking JDBC and JPA
- Test Databases
- Verifying Transactionality and Cleanup
- Web Components
- Mocking the Web Container
- Asynchronous Messaging
- Mocking the JMS Session
- Web-Services APIs: JAX-WS and JAX-RS
Each student in our Live Online and our Onsite classes receives a comprehensive set of materials, including course notes and all the class examples.
Experience in the following is required for this Java Fundamentals class:
- Solid Java programming experience is essential