Introduction to Java Testing
- 2 Days
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.
- Learn to build unit tests for Java classes using JUnit.
- Learn to write effective tests, and design classes for testability.
- Understand test-driven development (TDD) and use dynamic mocking to support isolated testing.
- Develop effective testing strategies for Java-EE components.
- Solid Java programming experience is essential -- especially object-oriented use of the language.Language features and techniques that are integral to some lab exercises include interfaces and abstract classes, threading, generics and collections, and recursive methods.
- 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
- 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
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.