Maxtrain.com - info@maxtrain.com - 513-322-8888 - 866-595-6863
Test-Driven Development (TDD) and JUnit Essentials
Description
Test-Driven Development (TDD) and JUnit Essentials Introduction
Welcome to our in-depth, three-day training course on Test-Driven Development (TDD) and Unit Testing with a special focus on JUnit and related open-source testing frameworks. This course is meticulously designed for developers seeking to enhance their skills in writing robust, high-quality Java programs using the principles of test-driven development.
Dive into a comprehensive learning experience where you’ll not only grasp the fundamental concepts and advantages of TDD but also get hands-on practice with the latest techniques and best practices in the industry. We will start by exploring the core features of JUnit, a pivotal tool in TDD, providing you with the necessary knowledge to effectively implement unit testing in your development process.
As part of this immersive learning journey, you will engage in a practical project that spans the entirety of the course. This project focuses on applying TDD methodologies to develop a sophisticated, multi-layered web application, complete with database integration.
The lab sessions are tailored specifically to reinforce TDD concepts in a real-world context, allowing you to experience firsthand how TDD can be utilized to build complex software systems. These sessions are designed not just to teach you the theory behind TDD and JUnit but to provide a hands-on environment where you can apply these concepts to build a functional and robust application.
By the end of this course, you will be equipped with the essential skills to employ TDD and unit testing strategies confidently, ensuring the delivery of reliable and maintainable code.
Test-Driven Development (TDD) and JUnit Essentials Course Objectives
- Working in a hands-on learning environment, guided by our expert team, you’ll explore:
- The role of Unit Testing in software development and testing
- How to write effective Unit Testing
- The properties of effective unit tests
- The benefits of the test-first and Test-Driven Development
- Techniques and practices to aid in the successful adoption of Test-Driven Development
- JUnit and the JUnit Test Runner interface
Prerequisites
Students should have development skills at least equivalent to the following course(s) or should have attended as a pre-requisite:
- Fast Track to Core Java 17 Programming for OO Developers
Audience
This programming course is for students with hands-on Java development experience.
Attending titles may include:
- Software Developers and Programmers
- Agile Practitioners
- Quality Assurance Professionals
- Software Testers
- Product Owners
- Project Managers
- IT Managers or Software Engineers.
Test-Driven Development (TDD) and JUnit Essentials Outline
Test-Driven Development
- Rationale for TDD
- The process of TDD
- Advantages to TDD
- Side-effects of TDD
- Tools to support TDD
- Tutorial: Setup IntelliJ for Using Maven
Session: Unit Testing using JUnit
Unit Testing Fundamentals
- Purpose of Unit Testing
- Good Unit Tests
- Test Stages
- Unit Testing Vs Integration Testing
- Understanding Unit Testing Frameworks
Jumpstart: JUnit 5.x
- Understand and work with the features of JUnit
- Write unit tests using @Test annotation
- Test Result Verification (Assertions)
- Manage fixtures using @BeforeEach, @AfterEach, @BeforeAll and @AfterAll annotations
- Maven setup using Surefire plugin
- Lab: Demo JUnit
- Lab: Build JUnit Case Study
- Lab: Jumpstart JUnit
Annotations
- Use @DisplayName to specify a custom name for the test
- Check for exceptions thrown by test
- Use @Disabled to prevent a test class or method from running
- Use timeouts to fail test that take longer than required
- Test Execution Order
- Lab: Working with @Test Annotation
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
- Lab: Working with Hamcrest
Parameterized Tests
- The @ParameterizedTest annotation
- A parameterized test to test code under several conditions
- Define different sources for test data (@ValueSource, @CsvSource, @CsvFileSource,@EnumSource, @MethodSource, @ArgumentSource)
- Lab: Working with Parameterized Tests
Advanced Features
- JUnit 4 vs JUnit 5
- Nested Unit Tests
- Repeated Tests
- JUnit Extensions
- ExecutionConditions
- Lambda Support
- Grouped Assertions
- Lab: Working with Advanced Features
JUnit Best Practices
- “Good” Tests
- Bad Smell
- White-Box Unit Testing
- Black-Box Unit Testing
- Automation and Coverage
Session: Mocking
Mocking of Components
- Why We use Test Dummies
- Working with Mock Objects
- Using Mocks with the User Interface
- Mock Object Strategies
Mock Objects and Mockito
- Mockito Description and Features
- Mockito Object Lifecycle
- JUnit 5 and Mockito Dependency Injection
- Stubs Using ArgumentMatchers
- Verifying Behavior in Mockito
- Partial Mock Objects
- The Spy annotation
- Lab: Mock Object and Mockito
PowerMock
- PowerMock Description and Features
- Using PowerMockito
- @PrepareForTest
- Mocking a final class or final method
- Mocking a Static Method
Session: Advanced Topics
State-based vs. Interaction-based Testing
- State-based Testing
- Interaction-based Testing
- Mock Objects Support Each Approach
- Three Areas to Check in a Test
- Lab: Interaction-based Testing
Improving Code Quality Through Refactoring
- Refactoring Overview
- Refactoring and Testing
- Refactoring to Design Patterns
- Lab: Refactoring
- Lab: Best Practices – Refactoring Tests
Database Testing: DbUnit
- Setting up DbUnit
- Defining a Dataset File in XML, CSV or Excel
- Writing a DbUnit Test Class
- Assert the results
- Use the FailureHandler and ValueComparer
- Using Date and Time in test sets
- Export a data set
- Lab: Introduction to DbUnit
- Lab: DbUnit Assertions
- Lab: Selenium and DbUnit
$1995.00
|
3 Days Course |