Realdolmen Education

Details

Unit Testing with Java

This course is currently not scheduled on the open calendar, but can be organized on request.

Request Course

Duration

2 day(s)

Audience

Beginner to intermediate Java developers who want to get some trust in his/her coding.

Prerequisites

Java knowledge and experience with IDE.

Objectives

This course will teach you how to introduce unit testing in your daily work, to increase stability, maintainability and productivity.

Methods

Classroom training with hands-on exercises.

Description

Unit testing has been part of software development for many years, but the increasing emphasis on it over the last decade has benefited software development. Unit testing has a long history in software development and has long since proven itself to not be a fad.

In this course, RealDolmen provides you with a thorough understanding of what unit testing is, what the advantages and benefits of unit testing is.

We will cover this step by step, starting with some simple unit tests, then adding some help of (mocking-)framework(s).We will turn the world around by introducing Test Driven Design and we will feel the benefit of it in some exercises. All of this can be integrated easily in existing projects.

Plenty of exercises are provided and are interleaved with the theory to allow the participant to put all the newly acquired information into practice. All of this is coached by highly skilled instructors with years of experience in teaching and practice.

If you are looking for a quality training in Unit Testing, you have found it here!

Contents

  • 1. Unit Testing with Java
    • 1.1. Course Objectives
    • 1.2. Agenda
  • 2. Introduction
    • 2.1. Software Testing
    • 2.2. How And What To Test
    • 2.3. Static Testing
    • 2.4. Dynamic Testing
    • 2.5. Automated Testing
    • 2.6. Continuous Integration
    • 2.7. Showcase: Jenkins
    • 2.8. Test Transparency Models
    • 2.9. White-box testing
    • 2.10. Black-box testing
    • 2.11. Levels Of Testing
    • 2.12. When To Test
    • 2.13. Testing Domains
  • 3. JUnit - Introduction
    • 3.1. What is JUnit?
    • 3.2. xUnit Architecture Concepts
    • 3.3. JUnit Dependencies
    • 3.4. Test Cases
    • 3.5. Ignoring Tests
    • 3.6. Executing Test Cases
  • 4. JUnit - Assertions and Assumptions
    • 4.1. Assertions
    • 4.2. Hamcrest Assertions
    • 4.3. Assumptions
  • 5. JUnit - Fixtures
    • 5.1. What are Fixtures?
    • 5.2. @Before and @After
    • 5.3. @BeforeClass and @AfterClass
  • 6. JUnit - Test Runners
    • 6.1. JUnitCore
    • 6.2. @RunWith
  • 7. JUnit - Test Suites and Categories
    • 7.1. Grouping Tests Using Suites
    • 7.2. Using Categories
    • 7.3. Advantages of Categories
  • 8. JUnit - Parameterized Tests and Theories
    • 8.1. Parameterized Tests
    • 8.2. Theories
  • 9. JUnit - Rules
    • 9.1. What are Rules?
    • 9.2. Creating Rules
    • 9.3. Using Rules
    • 9.4. Rule Example
    • 9.5. Built-in Rules
    • 9.6. Chaining Rules
    • 9.7. Dealing With Exceptions
    • 9.8. Test Timeouts
  • 10. JUnit - Best Practices
    • 10.1. Order of Test Execution
    • 10.2. Running Tests From Maven
    • 10.3. Code Quality Of Unit Tests
    • 10.4. Test Granularity
    • 10.5. Testing And Encapsulation
    • 10.6. Test Semantics
    • 10.7. Test Driven Development
  • 11. DBUnit - Introduction
    • 11.1. What is DBUnit?
    • 11.2. Rationale
    • 11.3. DBUnit Concepts
    • 11.4. DBUnit Dependencies
  • 12. DBUnit - Using DBUnit
    • 12.1. DBUnit as a Fixture
    • 12.2. Library Interaction
    • 12.3. IDatabaseConnection
    • 12.4. IDataSet
    • 12.5. DatabaseOperation
    • 12.6. IDatabaseTester
    • 12.7. Utility Superclass
    • 12.8. Database Assertions
  • 13. DBUnit - Best Practices
    • 13.1. Database Environments
    • 13.2. Organizing DataSets
    • 13.3. Fixture Initialisation Order
  • 14. Introduction to Mocks and Stubs
    • 14.1. What are Mocks and Stubs?
    • 14.2. System Under Test and Collaborators
    • 14.3. Doubles
    • 14.4. The Mock-Stub Dichotomy
    • 14.5. Test Phases
    • 14.6. Verification
    • 14.7. Double Libraries in Java
    • 14.8. Double Libraries in .NET
    • 14.9. Best Practices
  • 15. Introduction to Mockito
    • 15.1. What is Mockito?
    • 15.2. Mockito Dependencies
  • 16. Mockito - Creating Mocks
    • 16.1. Mockito's API
    • 16.2. Once Upon A Time
    • 16.3. Test Subject
    • 16.4. Creating Mocks
    • 16.5. Using Annotations
    • 16.6. Mock Instances
    • 16.7. Using Mocks
  • 17. Mockito - Stubbing
    • 17.1. Using a Stub on a Mock?
    • 17.2. Rationale of Method Stubbing
    • 17.3. When Then
    • 17.4. OngoingStubbing
    • 17.5. Stubbing Voids
    • 17.6. Argument Matchers
    • 17.7. Fluent Interface
    • 17.8. Example
    • 17.9. What are Spies?
    • 17.10. Using Spies
  • 18. Mockito - Verification
    • 18.1. What is Verification?
    • 18.2. Verification Modes
    • 18.3. Additional Verification
    • 18.4. Resetting Verification State
    • 18.5. Ordered Verification
    • 18.6. Argument Verification
    • 18.7. ArgumentCaptor
    • 18.8. Automatic Collaborator Injection
  • 19. Mockito - Best Practices
    • 19.1. Stubbing vs Verification
    • 19.2. Argument Matching Tightness
  • 20. Code Coverage
    • 20.1. What is Code Coverage
    • 20.2. Code Coverage Categories
    • 20.3. Code Coverage Tools
    • 20.4. Code Coverage Mechanics
    • 20.5. Code Coverage Reports
    • 20.6. Showcase Example: Cobertura
    • 20.7. Mutation Testing
    • 20.8. Mutation Testing Principle
    • 20.9. Mutation Outcomes
    • 20.10. Mutation Test Reports
    • 20.11. Showcase Example: Pitest
  • 21. Test Driven Development
    • 21.1. What is Test Driven Development?
    • 21.2. Software Evolution
    • 21.3. Testing Before
    • 21.4. Tests as Documentation
    • 21.5. Test Automation
    • 21.6. Refactoring
    • 21.7. Keeping it Simple
  • 22. How to to TDD
    • 22.1. The Question
    • 22.2. Sequence of Steps
    • 22.3. Step One: New Feature Request
    • 22.4. Step Two: Write Simple Tests
    • 22.5. Step Three: Verify Test Failure
    • 22.6. Step Four: Simplest Implementation
    • 22.7. Step Five: Verify Test Success
    • 22.8. Step Six: Refactor
    • 22.9. Repeat
  • 23. TDD and Mocking
    • 23.1. A Good Match
    • 23.2. Classicist versus Mockist
    • 23.3. Classicist Testers
    • 23.4. MockistTesters
  • 24. In-Closing
    • 24.1. Other Libraries
    • 24.2. Conclusion