Consulting Training Blog Careers About Us Contact Us
All Classes Will Be Held Virtually – Live Online Intertech's Training Division has been successfully instructing professionals through virtual live online training since the advent of the smartboard. It is a proven form and offers the convenience of live questions, group interaction, and labs with an instructor looking over your shoulder. Because of this, we will continue all classes live but virtually, including Agile and Scrum instruction, so businesses and individual’s seeking professional development can keep moving forward during these unexpected times.

Java Testing with JUnit Training

Course ID: CC-191
Duration: 2 Days

Upcoming Classes

Click the Get Notified button for priority notification when a class is next scheduled.

Get Notified

On Site/Private

Can't find a class that fits right for you? Contact us to inquire about scheduling your own private class

Contact Us

Description

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.

Bring This Course To You

For groups of 5 or more, let Intertech bring this course to your location. Customized versions tailored towards your objectives are also available.

Learn More

Learning Objectives

  • Build unit tests for Java classes using JUnit.
  • 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.

Prerequisites

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. Complete Java is excellent preparation.

Course Outline

Chapter 1. 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

Chapter 2. 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
  • Factories
  • Testing and Threads

Chapter 3. Test-Driven Development

  • Writing the Test First
  • The TDD Cycle
  • Advantages of TDD
  • Resistance to TDD
  • A Case Study

Chapter 4. Mocking

  • Mock Objects in Testing
  • Mock Objects in Test-Driven Development
  • Static vs. Dynamic Mocks
  • Stubbing
  • Verifying
  • Matching and Capturing
  • Using a Spy
  • Partial Mocking

Chapter 5. 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
  • Auto-Rollback
  • Verifying Transactionality and Cleanup
  • Web Components
  • Mocking the Web Container
  • Asynchronous Messaging
  • Mocking the JMS Session
  • Web-Services APIs: JAX-WS and JAX-RS

Free Resources from Intertech

Complete Guide to Becoming a Full Stack Developer

Free eBook: Can a Project Be Too Small for Test Automation?

Free Whitepaper: Spring 4 Generic Qualifiers

X