Testing¶
Audience: contributors only. This document describes how to run and extend the test suite for causaliq-discovery. If you are an end-user looking for information on installing and configuring supported algorithms, see the User Guide.
Test categories¶
| Category | Location | Runs in CI | Coverage |
|---|---|---|---|
| Unit | tests/unit/ |
Always | Required (100%) |
| Functional | tests/functional/ |
Always | Required (100%) |
| Integration | tests/integration/ |
Always | Required (100%) |
| R integration | tests/integration/bnlearn/ |
Manual only | Excluded |
| Java integration | tests/integration/tetrad/ |
Manual only | Excluded |
Running tests locally¶
Unit, functional and integration tests¶
R integration tests¶
R integration tests call real R/bnlearn via subprocess and are skipped automatically when R or bnlearn is not installed.
Java integration tests¶
Java integration tests run real Tetrad FGES calls via the pinned
causal-cmd JAR. They are skipped automatically when Java is not
available or CQ_JAVA_DIR is not configured.
Fetch the JAR from the private third-party binaries release:
The release asset is currently named
causal-cmd-1.3.0-jar-with-dependencies.jar.
The helper script stores it locally as
./.artifacts/causal-cmd-1.3.0.jar for adapter compatibility.
Set CQ_JAVA_DIR to the downloaded JAR directory, then run:
For an end-to-end local run, use:
All CI checks (formatting, types, coverage)¶
R integration tests on GitHub Actions¶
R integration tests do not run automatically on every commit. They are triggered manually when needed (e.g. before a release, or after changes to the bnlearn adapter):
- Go to the repository on GitHub.
- Click the Actions tab.
- Select R Integration in the left sidebar.
- Click Run workflow → Run workflow.
The workflow runs on Ubuntu and Windows with Python 3.11. R packages are cached between runs to avoid reinstalling bnlearn from scratch each time.
Java integration tests on GitHub Actions¶
Java integration tests do not run automatically on every commit. They are triggered manually when needed (e.g. before a release, or after changes to the Tetrad adapter):
- Go to the repository on GitHub.
- Click the Actions tab.
- Select Java Integration in the left sidebar.
- Click Run workflow.
By default, java_profile=tetrad_fges_1_3_0 is selected and the
workflow uses pinned values for tag, asset name and checksum.
This supports one-click runs with no manual input.
To run another version, either:
- select
java_profile=customand provide all three override inputs (jar_tag,jar_asset_name,jar_sha256), or - keep the default profile and fill one or more override inputs.
Prerequisite: THIRD_PARTY_BINARIES_TOKEN repository secret¶
The workflow downloads the pinned JAR from the private
causaliq/third-party-binaries repository. A repository secret
must be configured before the workflow can run.
Step 1 — Create a fine-grained personal access token (PAT)
- Go to GitHub → Settings → Developer settings → Personal access tokens → Fine-grained tokens.
- Click Generate new token.
- Set:
- Token name:
causaliq-third-party-binaries-read - Description: Read-only token for downloading pinned Java
artefacts from
causaliq/third-party-binariesfor causaliq-discovery integration tests. - Resource owner:
causaliq - Repository access: only
causaliq/third-party-binaries - Permissions: Contents → Read-only; Metadata → Read-only (required automatically)
- Click Generate token and copy the value immediately (it is shown only once).
Step 2 — Add the token as a repository secret
- Go to the causaliq-discovery repository on GitHub.
- Click Settings → Secrets and variables → Actions.
- Click New repository secret.
- Name:
THIRD_PARTY_BINARIES_TOKEN; Value: paste the copied token. - Click Add secret.
The workflow runs on Ubuntu and Windows with Python 3.11 and Java 17.