Test Driven Development In Java
Outline

Test-Driven Development in Java

Test-driven development is one of the key enablers for agile development, that allows us to develop stable and refactorable code, whose intent is clear and whose design can evolve incrementally. TDD allows us to capture and validate the rules governing the behaviour of our code. And… it's also fun! There's a bunch of interesting tools available to assist us in developing robust tests, in identifying which tests to write, to help us compose tests and to automatically run our tests. The course is taught through presentation, demos, hands-on labs and directed discussions.

Objectives

  • Use JUnit and mocking libraries to write tests
  • Run tests from an IDE and from Maven/Gradle build scripts
  • Apply patterns and practices for writing testable code
  • Extend the scope of tests into analysis, design and documentation
  • Use tests to communicate with the customer

Prerequisites

  • Delegates should have some appreciation for the issues involved in building large-scale applications. Delegates should also have a development background.

Contents

Introduction

  • Why test-driven development?
  • Is TDD necessary?
  • TDD is about...
  • red/green/refactor

Getting Started

  • Separating code from tests
  • Package structures
  • JUnit basics
  • Assertions
  • JUnit setup/teardown
  • Exceptions

Writing Tests

  • Base test classes
  • Matchers
  • Naming / Organization
  • Implementation strategies
  • Exploring APIs
  • Parameterized test runners

Writing

  • Equals and value objects
  • Seams and sensing
  • Seam types
  • Inheritance
  • Singletons and Statics
  • Dependency injection

Test doubles

  • Test double taxonomy
  • Stubs
  • Fakes
  • Mocks
  • Mocking Libraries such as Mockito and PowerMock
  • Setting Expectations and Verifying Interactions
  • Mocking Gotchas
  • Testing Legacy Code

Understanding the Code through Tests

  • Showing the Call Hierarchy
  • Generating Documentation from Tests
  • Parsing the Test Source Code
  • Transcripts
  • Fluent Interfaces

Organising Tests

  • Test Suites
  • Explicitly-built Test Suites
  • Implicitly-built Test Suites
  • Filtering and Sorting
  • Ordering

TDD in Context

  • Relationship to Other Agile Practices
  • Closing Discussion

More on fixtures

  • Making the Context Concrete
  • One-time Setup for Classes
  • One-time Setup for Suites
  • Fixtures and Superclasses
  • Object Mothers
  • Fixtures as Objects
  • Data-driven Fixtures
  • Using Databases
  • Testing Database Code

Theories

  • Tests vs Theories
  • Triangulating Tests
  • Parameter Suppliers
  • Assumptions

Tests as Specification

  • The Trouble with TDD
  • Behaviour Driven Design using Cucumber
  • Customer Acceptance Testing using Cucumber and Selenium

Do You Have a Question?

);

Accreditations:

Our team are AWS Professional Certified Solutions  ArchitectsOur team are AWS Devops Specialty CertifiedAltova Training PartnerAltova Consulting PartnerOur team members are Professional Scrum master certified
Website Design by tinyBox Creative