Chrysalis 🦋

A metamorphic testing framework that utilizes metamorphic relations to detect bugs.

What is Metamorphic Testing?

Metamorphic testing is a software testing technique that examines relations between multiple executions of a program. Instead of checking if a program produces the “correct” output for a given input (which may be unknown) metamorphic testing verifies that certain relationships hold between inputs and their corresponding outputs.

A metamorphic relation consist of two key components: a transformation and an invariant. The transformation defines how to modify the original input to create a follow-up test case, such as shuffling the order of elements in a list, scaling numerical values, or adding redundant data. The invariant specifies the expected relationship between the outputs of the original and transformed inputs, describing how the results should relate to each other even when the exact values are unknown. For example, when testing a sorting algorithm, the transformation might involve shuffling the input array, while the invariant would assert that both the original and shuffled inputs should produce identically sorted outputs.

Key Features

  • Easy Registration: Simple API to register metamorphic relations

  • Chain Testing: Execute multiple transformations in sequence

  • Tuneable Testing Engine: Configure testing parameters

  • Logging and Replay: Comprehensive test execution logs

Installation

pip install chrysalis-test

Publication

Chrysalis: A Lightweight Logging and Replay Framework for Metamorphic Testing in Python