UnitTesting

Table of Contents

Introduction

Unit tests (aka. developer tests) are testing the correct behavior of individual parts of the source source code, e.g. classes, methods, functions or groups thereof. All not tested parts of the code are expected to work correctly.

The purpose of the unit tests is to feel confident that the code works correctly and didn't break anything (see youtube.com).

The test methods should follow the "Arrange Act Assert" pattern. The "Arrange" part sets up the test objects, "Act" performs the action to be tested and "Assert" checks that the result is correct. The sections should be separated by blank lines (see c2.com).

Read more

Requirements

  • The whole test suite need to be fast so that it can be executed multiple times a day, at least before pushing it to the SCM.
  • The test need to be reliable in order to be useful.

Read more:

Test doubles

Mutation testing

Read more

GitHubImpressum