Call : (+91) 968636 4243
Mail : info@EncartaLabs.com
EncartaLabs

Unit Testing with JUnit

( Duration: 3 Days )

JUnit 5 and EasyMock make it possible to write higher-quality Java code. These powerful tools are designed to support robust, predictable and automated testing development in the Java enterprise application arena. This JUnit 5 training course is geared for experienced developers who need to get up and running with essential unit testing skills using JUnit, Mockito, and other tools. Students will leave the course armed with the skills required to leverage solid unit testing practices using the latest industry techniques and best practices. This course quickly introduces developers to the features of JUnit and educates them regarding JUnit’s strengths and weaknesses.

By attending JUnit 5 workshop, delegates will learn to:

  • Understand what unit testing is and what it is not intended to cover
  • Understand JUnit 5
  • Understand and use the JUnit Test Runner interface
  • Use JUnit to drive the implementation of Java code
  • Test applications using native IDE support
  • Best practices and patterns for unit testing
  • Understand JUnit’s strengths and weaknesses
  • Understand the role of debugging when done in conjunction with tests
  • Understand not only the fundamentals of the TDD using Java, but also its importance, uses, strengths and weaknesses
  • Understand how JUnit affects your perspective on development and increases your focus on a task
  • About good JUnit coding style
  • Create well-structured JUnit programs
  • Understand how JUnit testing can be used for either state-based or interaction-based testing
  • Extend testing with mock objects using Mockito

  • Solid understanding of Java
  • Familiarity with testing concepts (e.g. unit, integration, functional, load)

The JUnit 5 class is ideal for:

  • Java developers, quality-assurance engineers and development managers.

COURSE AGENDA

1

Unit Testing Fundamentals

  • Purpose of Unit Testing
  • Good Unit Tests
  • Test Stages
  • Unit Testing Vs Integration Testing
  • Understanding Unit Testing Frameworks
2

Jumpstart: JUnit 5.x

  • Understand and work with the features of JUnit
  • Write unit tests using @Test annotation
  • Use @DisplayName to specify a custom name for the test
  • Manage fixtures using @BeforeEach, @AfterEach, @BeforeAll and @AfterAll annotations
  • Launch tests using @ExtendWith (@RunWith – JUnit 4+) annotation
  • Build test suites using @SelectPackages or @SelectClasses
  • Use @Disabled to prevent a test class or method from running
3

Annotations

  • Describe the test execution cycle
  • Check for exceptions thrown by test
  • Use timeouts to fail test that take longer than required
4

Hamcrest

  • Learn the notation of assertThat
  • Know the objective of Hamcrest library
  • Use Hamcrest's logical and object matchers
  • Use Hamcrest's number and collection matchers
5

Parameterized Tests

  • The @ParameterizedTest annotation
  • A parameterized test to test code under several conditions
  • Generic tests to support parameterized testing
6

Advanced Features

  • Nested Unit Tests
  • Repeated Tests
  • JUnit Extensions
  • Conditions
  • Lambda Support
  • Grouped Assertions
7

JUnit Best Practices

  • "Good" Tests
  • Bad Smell
  • White-Box Unit Testing
  • Black-Box Unit Testing
  • Automation and Coverage
8

Mocking of Components

  • Why We use Test Dummies
  • Mock Objects
  • Working with Mock Objects
  • Using Mocks with the User Interface
  • Mock Object Strategies
9

Mock Objects and Mockito

  • Mockito Description and Features
  • Mockito Object Lifecycle
  • Create/Expect Phase
  • Replay/Verify Phase
  • Mocking Complex Objects
10

Improving Code Quality Through Refactoring

  • Refactoring Overview
  • Refactoring and Testing
  • Refactoring to Design Patterns
  • Naming conventions

Encarta Labs Advantage

  • One Stop Corporate Training Solution Providers for over 6,000 various courses on a variety of subjects
  • All courses are delivered by Industry Veterans
  • Get jumpstarted from newbie to production ready in a matter of few days
  • Trained more than 50,000 Corporate executives across the Globe
  • All our trainings are conducted in workshop mode with more focus on hands-on sessions

View our other course offerings by visiting https://www.encartalabs.com/course-catalogue-all.php

Contact us for delivering this course as a public/open-house workshop/online training for a group of 10+ candidates.

Top
Notice
X