Table of Contents

Testing conventions

Setup with stack

package.yaml

Test preparation

Folder: 'project/test'

Root: Spec.hs

In folder test is a haskell file as root for all tests name spec.hs.

Test module: Spec<Module>.hs

Beginning

Test tree by test group

HUnit test

QuickCheck test

Test types in more detail

QuickCheck

Control of test samples

QuickCheck tests with test data of random samples, and the frequency distribution of the ramdom samples can be controlled by the class Arbitrary.

Control of test samples for known types

Background: The following instances already exist with a standard distribution for sample data.

Problem: So, how to control them differently?

Solution: By declaration of a new type (by 'newtype').

Validation

The following symbols are possible for each validation criteria:

Functions and laws

Each function has its own test group designated as tgUnit<functionName>.

And each law has its own test group designated as tgLaw<LawName>.

Tests are validated by checking the following criteria:

After checking the above mentioned criteria, the result is documented as source code comment:

Classes

Each function has its own test group designated as tgClass<ClassName>.

Tests are validated by checking the following criteria:

After checking the abovementioned criteria, the result is documented as source code comment:

Modules

Each module exports a test group designated as testGroup.

Tests are validated by checking the following criteria: