Skip to main Content

Unit Testing with JUnit

  • Course Code JUNIT
  • Duration 2 days

Course Delivery

Additional Payment Options

  • GTC 15 inc. VAT

    GTC, Global Knowledge Training Credit, please contact Global Knowledge for more details

Company Event Price

Please call

Request Group Training Add to Cart

Course Delivery

This course is available in the following formats:

  • Company Event

    Event at company

  • Public Classroom

    Traditional Classroom Learning

  • Virtual Learning

    Learning that is virtual

Request this course in a different delivery format.

Course Overview

Top

This Unit Testing using JUnit course focuses on the fundamental concepts of Unit Testing as part of the Software Development Life Cycle and covers the core features of JUnit which is the most popular framework for implementing Unit Testing within Java projects. Version 4 of the JUnit Framework is used in this course.

This hands-on course shows delegates how to design and develop JUnit Test Cases for a variety of Java modules. Delegates will learn how to build related groups of Test Cases into Test Suites that can be run together to test multiple Java classes. Delegates will also learn how to integrate JUnit with build utilities such as Apache Ant and to customise test reports.

The use of Mocks and Stubs to isolate the system under test from external dependencies will also be covered and will be used to test Data Access Objects and Web Responses.

Exercises and examples are used throughout the course to give practical hands-on experience with the techniques covered.

Company Events

These events can be delivered exclusively for your company at our locations or yours, specifically for your delegates and your needs. The Company Events can be tailored or standard course deliveries.

Course Schedule

Top

Target Audience

Top

This Unit Testing using JUnit course is aimed at staff and consultants working as part of a development team using Unit Testing including; Programmers,Testers,Subject Matter Experts,Project Managers and anyone who needs a good understanding of the use of JUnit for Unit Testing within software development.

Course Objectives

Top

This course aims to provide the delegate with the knowledge to be able to describe the concepts of unit testing,design,write and execute test cases using JUnit,integrate JUnit with Apache Maven,stub and mock collaborators,and test DAOs and web responses.

Course Content

Top
Unit Testing using JUnit Training Course Course Contents - DAY 1

Course Introduction

  • Administration and Course Materials
  • Course Structure and Agenda
  • Delegate and Trainer Introductions

Session 1: UNIT TESTING

  • Introduction to Unit Testing
  • Other Categories of Software Testing
  • Introduction to Unit Test Structure and Organisation
  • Introduction to Test Doubles
  • Test Coverage
  • Guidelines for Good Unit Tests

Session 2: INTRODUCTION TO JUNIT

  • Main Features of JUnit
  • JUnit Syntax
  • Integrating JUnit with Eclipse

Session 3: WRITING TEST CASES

  • Test Project Structure
  • Test Case Structure
  • Junit Annotations
  • JUnit Assertions
  • Parameterised Junit Tests

Session 4: INTEGRATING WITH ANT AND MAVEN

  • JUnit Integration with Apache Ant
  • JUnit Integration with Apache Maven
Unit Testing using JUnit Training Course Course Contents - DAY 2

Session 5: TESTING STRATEGIES

  • Test Stubs
  • Command line arguments
  • Stubbing a Database Connection with JUnit
  • Stubbing a HTTP Connection with JUnit

Session 6: MOCKING

  • State vs Interaction Tests
  • Test Mocks
  • The Phases of Mocking
  • Mocking using JUnit and Mockito

Session 7: TESTING DATA ACCESS OBJECTS

  • Strategies for Testing Data Access Objects
  • Testing Entity Mappings using an In-Memory Database with JUnit and Hibernate

Session 8: TESTING WEB RESPONSES

  • Validating XML against a Schema
  • Testing HTML Responses using HTMLUnit
  • Testing XML Responses using XMLUnit

Course Prerequisites

Top

Delegates should have attended the pre-requisite Java Programming 2 course or have equivalent experience with the Java programming language.

Cookie Control toggle icon