8351  Reviews star_rate star_rate star_rate star_rate star_half

Java Testing with JUnit 5

JUnit 5 is substantively different than JUnit 4. Although the core testing principles are the same, there are substantial implementation differences, important new features, and a brand new extension...

Read More
Duration 2 days
Course Code JAV-312
Available Formats Classroom

Overview

JUnit 5 is substantively different than JUnit 4. Although the core testing principles are the same, there are substantial implementation differences, important new features, and a brand new extension model.

Ascendient Learning's Java Testing with JUnit 5 teaches experienced Java developers the fundamentals of unit testing using JUnit 5 and Mockito libraries. Attendees learn how to test enterprise components in the persistence, service, and web layers. Best practices are emphasized and demonstrated throughout this course.

Skills Gained

  • Understand the new JUnit 5 library structure, role of each component, and how they interact
  • Configure IDE projects to run tests natively, and via Maven Surefire
  • Write cohesive and effective tests and design classes for testability
  • Understand the full test lifecycle, and employ it to configure test fixtures
  • Run tests using all available mechanisms: IDE, Maven, JUnit Console Launcher, Launcher API
  • Use test discovery and filtering to define and run test plans, including conditional test execution
  • Employ naming conventions at every level - test name, classname, display name
  • Organize tests with assertion groups and nested tests
  • Use test interfaces to apply good OO principles to testing
  • Understand the new JUnit extension model, and how to write and use them
  • Understand JUnit 4 compatibility and migration
  • Use mock objects with Mockito to support isolated testing
  • Explore Mockito's facilities for dependency injection of mocks
  • Use argument matchers for more generalized testing with mocks
  • Implement partial mocking with spies
  • Understand the issues in testing enterprise components
  • Understand the two basic approaches: standalone testing with mocks, and in-container testing
  • Test database access components, using both fakes and an embedded database
  • Understand the additional issues involved in testing

Prerequisites

All students must have a good working knowledge of Java and OO, including the use of interfaces, abstract classes, collections, factories, and generics. Experience with Java 8 lambda expressions is helpful, but not required.

Course Details

Training Materials

All JUnit 5 training students receive comprehensive courseware.

Software Requirements

  • A recent version of Windows, macOS, or Linux with at least 8 GB RAM
  • JDK 8 or later
  • Eclipse or IntelliJ IDEA
  • Other free software - please contact us if you have purchased this class

Outline

  • Introduction
  • Unit Testing with JUnit 5
    • Overview
      • Unit Testing and JUnit Overview
      • New Features in JUnit 5
      • JUnit 5 Library Components
      • Naming Conventions and Organizing Tests
    • Tests and Assertions
      • Writing Test Methods
      • Assertions
      • Assertion Messages
    • Test Fixtures and Test Lifecycle
      • Creating and Using Text Fixtures
      • Test Run Lifecycle: @BeforeEach and @AfterEach, @BeforeAll and @AfterAll
      • Controlling Test Instances
  • Writing and Running Tests (includes a brief primer on Java 8 new features)
    • Additional Testing Needs
      • Testing for Exceptions
      • Setting Timeouts
      • Assertion Groups
    • Running Test
      • IDE Support: Eclipse, IntelliJ IDEA
      • Maven Configuration
      • JUnit Platform Console Launcher
      • Launcher API
      • Test Discovery and Selection
      • Display Names
      • Grouping and Filtering with Tags
      • Configuration Parameters
      • Nested Tests
    • Advanced Capabilities
      • Custom Composed Annotations
      • Inheritance with Test Classes
      • Extensions
      • Conditional Test Execution
      • Parameterized Tests
    • JUnit 4 Migration
      • The Do-Nothing Case
      • Using a JUnit 4 Runner
      • API Changes
      • JUnit 4 Runners and Rules
      • JUnit 4 Test Suites
    • Best Practices
      • Testing Void and Private Methods
      • Test Cohesion and Assertion Scope
      • Characteristics of Good Tests
      • Writing Testable Code
      • Testing Anti-Patterns
  • Testing with Mocks
    • Overview
      • Mock Objects as Collaborators
      • Mockito Overview
    • Creating and Using Mocks
      • Basic Steps in Mocking
      • The Mockito Class
      • Mock Creation with @Mock
      • JUnit 5 MockitoExtension
      • Stubbing
    • Additional Capabilities
      • Argument Matchers
      • Partial Mocking with Spies
      • Mocking the Unmockable
      • Dependency Injection of Mocks
  • Testing Enterprise Components
    • Overview
      • Unit Testing vs. Integration Testing
      • Testing with Mocks vs. In-Container Testing
      • Mocks vs. Fakes
    • Testing the Persistence Layer
      • Database Options: Installed, Embedded, Embedded-in-Memory
      • Standalone vs. In-Container Testing
      • Test Independence and Transaction Rollback
      • In-Container Testing with Arquillian [Overview]
    • Testing Services
      • Similar Issues, Different Layer
      • Working with External Resources
      • The Argument for In-Container Testing
    • Testing Web Components
      • Interfacing with External Clients
      • Difficulties in Standalone Testing with Mocks
      • Manual vs. Automated Testing
      • Automated Testing with Selenium [Overview]
  • Conclusion

Schedule

FAQ

Does the course schedule include a Lunchbreak?

Classes typically include a 1-hour lunch break around midday. However, the exact break times and duration can vary depending on the specific class. Your instructor will provide detailed information at the start of the course.

What languages are used to deliver training?

Most courses are conducted in English, unless otherwise specified. Some courses will have the word "FRENCH" marked in red beside the scheduled date(s) indicating the language of instruction.

What does GTR stand for?

GTR stands for Guaranteed to Run; if you see a course with this status, it means this event is confirmed to run. View our GTR page to see our full list of Guaranteed to Run courses.

Does Ascendient Learning deliver group training?

Yes, we provide training for groups, individuals and private on sites. View our group training page for more information.

What does vendor-authorized training mean?

As a vendor-authorized training partner, we offer a curriculum that our partners have vetted. We use the same course materials and facilitate the same labs as our vendor-delivered training. These courses are considered the gold standard and, as such, are priced accordingly.

Is the training too basic, or will you go deep into technology?

It depends on your requirements, your role in your company, and your depth of knowledge. The good news about many of our learning paths, you can start from the fundamentals to highly specialized training.

How up-to-date are your courses and support materials?

We continuously work with our vendors to evaluate and refresh course material to reflect the latest training courses and best practices.

Are your instructors seasoned trainers who have deep knowledge of the training topic?

Ascendient Learning instructors have an average of 27 years of practical IT experience and have also served as consultants for an average of 15 years. To stay current, instructors spend at least 25 percent of their time learning new, emerging technologies and courses.

Do you provide hands-on training and exercises in an actual lab environment?

Lab access is dependent on the vendor and the type of training you sign up for. However, many of our top vendors will provide lab access to students to test and practice. The course description will specify lab access.

Will you customize the training for our company’s specific needs and goals?

We will work with you to identify training needs and areas of growth.  We offer a variety of training methods, such as private group training, on-site of your choice, and virtually. We provide courses and certifications that are aligned with your business goals.

How do I get started with certification?

Getting started on a certification pathway depends on your goals and the vendor you choose to get certified in. Many vendors offer entry-level IT certification to advanced IT certification that can boost your career. To get access to certification vouchers and discounts, please contact info@ascendientlearning.com.

Will I get access to content after I complete a course?

You will get access to the PDF of course books and guides, but access to the recording and slides will depend on the vendor and type of training you receive.

How do I request a W9 for Ascendient Learning?

View our filing status and how to request a W9.

Reviews

This was effective way to provide a ton of information in a short time period.

The instructor was thorough and they also provided hands-on demonstrations with labs.

Brandon was a great instructor. The virtual course materials and labs provided were very informative.

Topics, material and specially instructor (Graham Godfrey) was beyond my expectations.

Class was very informative, although one lab didnt but will try again later