Skip to main content

Causal Testing Framework

A Causal Inference-Driven Software Testing Framework

Project Status: Active – The project has reached a stable, usable state and is being actively developed. CI tests codecov Documentation Status Ask DeepWiki Dynamic TOML Badge PyPI - Version conda-forge GitHub License DOI DOI

The Causal Testing Framework is composed of a causal inference-driven architecture designed for functional black-box testing. It leverages graphical causal inference (CI) techniques to specify and evaluate software behaviour from a black-box perspective. Within this framework, causal directed acyclic graphs (DAGs) are used to represent the expected cause–effect relationships between the inputs and outputs of the system under test, supported by mathematical foundations for designing statistical procedures that enable causal inference. Each causal test case targets the causal effect of a specific intervention on the system under test--that is, a deliberate modification to the input configuration expected to produce a corresponding change in one or more outputs.

Causal Testing Workflow Causal Testing Workflow

Installation

Requirements

  • Python 3.11, 3.12, 3.13 and 3.14

We recommend using conda or mamba for installation, as they provide better dependency management and environment isolation, particularly for scientific computing workflows.

First, create a new conda environment with a supported Python version, e.g:

conda create -n causal-testing-env python=3.13
conda activate causal-testing-env

Note: If you have Miniforge installed, you can replace conda with mamba in any of the commands below for faster package resolution.

Add the conda-forge channel:

conda config --add channels conda-forge
conda config --set channel_priority strict

Install causal-testing-framework:

conda install causal-testing-framework

Alternative: Install from PyPI

If you prefer using pip or need the development packages, you can install from PyPI:

pip install causal-testing-framework

or if you want to install with the development packages/tools:

pip install causal-testing-framework[dev]

For Developers/Contributors: Install from source

If you're planning to contribute to the project or need an editable installation for development, you can install directly from source:

git clone https://github.com/CITCOM-project/CausalTestingFramework
cd CausalTestingFramework

then to install a specific release:

git fetch --all --tags --prune
git checkout tags/<tag> -b <branch>
pip install . # For core API only
pip install -e . # For editable install, useful for development work

For more information on how to use the Causal Testing Framework, please refer to our documentation. If you have any questions, you can also reach us by email.

[!NOTE] We recommend you use a 64-bit OS (standard in most modern machines) as we have had reports of the installation crashing on legacy 32-bit Debian systems.

Usage

[!NOTE] Step-by-step tutorials can be found on our documentation.

  1. To run the causal testing framework, you need some runtime data from your system, some causal test cases, and a causal DAG that specifies the expected causal relationships between the variables in your runtime data (and any other relevant variables that are not recorded in the data but are known to be relevant).

  2. If you do not already have causal test cases, you can convert your causal DAG to causal tests by running the following command.

causal-testing generate --dag-path $PATH_TO_DAG --output $PATH_TO_TESTS
  1. You can now execute your tests by running the following command.
causal-testing test --dag-path $PATH_TO_DAG --data-paths $PATH_TO_DATA --test-config $PATH_TO_TESTS --output $OUTPUT

The results will be saved for inspection in a JSON file located at $OUTPUT. In the future, we hope to add a visualisation tool to assist with this.

How to Cite

If you use our framework in your work, please cite the following:

This research has used version X.Y.Z (software citation) of the Causal Testing Framework (paper citation).

The paper citation should be the Causal Testing Framework paper, and the software citation should contain the specific Figshare DOI of the version used in your work.

BibTeX Citations
Paper ``` @ARTICLE{Clark_etal_2023, author = {Clark, Andrew G. and Foster, Michael and Prifling, Benedikt and Walkinshaw, Neil and Hierons, Robert M. and Schmidt, Volker and Turner, Robert D.}, title = {Testing Causality in Scientific Modelling Software}, year = {2023}, publisher = {Association for Computing Machinery}, url = {https://doi.org/10.1145/3607184}, doi = {10.1145/3607184}, journal = {ACM Trans. Softw. Eng. Methodol.}, month = {jul}, keywords = {Software Testing, Causal Testing, Causal Inference} } ```
Software (example) ``` @ARTICLE{Wild2023, author = {Foster, Michael and Clark, Andrew G. and Somers, Richard and Wild, Christopher and Allian, Farhad and Hierons, Robert M. and Wagg, David and Walkinshaw, Neil}, title = {CITCOM Software Release}, year = {2023}, month = {nov}, url = {https://orda.shef.ac.uk/articles/software/CITCOM_Software_Release/24427516}, doi = {10.15131/shef.data.24427516.v1} } ```

Acknowledgements

The Causal Testing Framework is supported by the UK's Engineering and Physical Sciences Research Council (EPSRC), with the project name CITCOM - "Causal Inference for Testing of Computational Models" under the grant EP/T030526/1.

Metadata

Release files for causal-testing-framework 15.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for causal-testing-framework 15.0.1
File Size Uploaded
causal_testing_framework-15.0.1.tar.gz 2.8 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for causal-testing-framework 15.0.1
File Interpreter ABI Platform
causal_testing_framework-15.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 5.6 MB

Release files / causal_testing_framework-15.0.1.tar.gz

Download URL causal_testing_framework-15.0.1.tar.gz
Size 2.8 MB
Tags Source
SHA-256 checksum
How to use checksums
bd4bd450dc3e65572b9a1c0087077ad373fba294d075d1611807cd9ee696dbb3
BLAKE2b-256 checksum
How to use checksums
0c457149747d26d34662e4a06de2b0bca9e370c684f4c1d869620b2486108c8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / causal_testing_framework-15.0.1-py3-none-any.whl

Download URL causal_testing_framework-15.0.1-py3-none-any.whl
Size 2.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
08f7850e693cb7beac2cc322e800b74031f4231c97490a08be7db3fa9a9da548
BLAKE2b-256 checksum
How to use checksums
6fac6137b958b263b594a36dbf78b9484bdffd739f91b219a408bcd191e88261
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

15.0.1 This release

2 release files

15.0.0

2 release files

14.3.1

2 release files

14.3.0

2 release files

14.1.0

2 release files

14.0.0

2 release files

13.2.0

2 release files

13.1.0

2 release files

13.0.0

2 release files

12.0.1

2 release files

12.0.0

2 release files

11.0.0

2 release files

10.0.2

2 release files

9.0.2

2 release files

9.0.1

2 release files

9.0.0

2 release files

8.1.0

2 release files

8.0.0

2 release files

7.1.1

2 release files

7.1.0

2 release files

7.0.0

2 release files

6.0.1

2 release files

6.0.0

2 release files

5.3.4

2 release files

5.3.3

2 release files

5.3.2

2 release files

5.3.1

2 release files

5.3.0

2 release files

5.2.2

2 release files

5.2.1

2 release files

5.2.0

2 release files

5.1.3

2 release files

5.1.2

2 release files

5.1.1

2 release files

5.1.0

2 release files

4.3.0

2 release files

4.2.0

2 release files

4.1.0

2 release files

4.0.1

2 release files

4.0.0

2 release files

3.2.0

2 release files

3.1.0

2 release files

3.0.0

2 release files

2.0.8

2 release files

2.0.7

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page