Skip to content

Testing workflows with nf-test

geni test runs the nf-test suite of a registered workflow version on GENI, on the same engine, Batch queue and buckets a submission uses. Each test’s Nextflow run sends its tasks to your queue exactly as a submission would, so a suite that passes here exercises the containers, permissions and instance types production will use.

A test run is its own resource, not a kind of submission. It runs the whole suite in one head job and ends SUCCEEDED when every test passed, or FAILED when any did. The per-test results are written to the output folder you choose.

  • GENI CLI 0.2.2 or later. Earlier versions have no geni test command. Check with geni --version and upgrade with npm install -g geni-bioinfo@latest (see Installation).
  • AWS only. Test runs are rejected with 422 on a GCP environment.
  • Nextflow engine 26.04.6-3 or later. Older engine images do not have nf-test. Create one with --engine-version 26.04.6-3 (see Create an engine) or move an existing engine there with Update an engine.
  • A ZIP workflow version with main.nf and nf-test.config at the root. A single .nf file has nowhere to hold the tests.
  • The analyst or admin role, or an API token with the tests:* permissions. Anyone who can submit a sample can run and cancel tests.
Terminal window
geni test create \
--workflow-name rnaseq \
--workflow-version 1.4.0 \
--engine-id <engine-id> \
--queue-id <queue-id> \
--output-folder s3://lab-tests/rnaseq/1.4.0/

The engine and queue follow the same rules as for a submission: both active, in the same environment, and the engine needs write permission on the output folder and read permission on any bucket the tests read inputs from. --fallback-queue-id works as it does on geni submission create.

Select part of the suite with nf-test’s own filters:

Option Passed to nf-test as Example
--nf-test-tag <a,b> --tag --nf-test-tag smoke,fast
--nf-test-filter <types> --filter — process, workflow, pipeline, function --nf-test-filter process
--update-snapshot --update-snapshot after an intentional output change
--nextflow-profile <p> added to the profile in nf-test.config --nextflow-profile test

--tag key=value attaches GENI tags to the run, as on a submission; the workflow’s own tags are inherited.

Follow and stop it:

Terminal window
geni test list --workflow-name rnaseq --status FAILED
geni test get <test-id> # status and output folder; --format json for every field
geni test cancel <test-id>

A run can be cancelled until it finishes: in SUBMITTED, PENDING, RUNNABLE, STARTING or RUNNING. The tasks it started on your queue are stopped with it.

nf-test needs nothing GENI-specific beyond where the files are and how assertions reach the outputs. A minimal bundle:

main.nf
nextflow.config
nf-test.config
tests/
main.nf.test
main.nf.test.snap
params.yaml
modules/
align.nf.test
nf-test.config
config {
testsDir "tests"
workDir ".nf-test"
// Process tests run a generated script under .nf-test/, which does not pick up
// the workflow's nextflow.config on its own.
configFile "nextflow.config"
profile ""
plugins {
load "nft-utils@1.2.1"
}
}
Terminal window
zip -r rnaseq-1.4.0.zip main.nf nextflow.config nf-test.config tests modules bin
geni workflow create --workflow-name rnaseq --workflow-version 1.4.0 --file rnaseq-1.4.0.zip

There is no --params-file on a test run. Each test declares its parameters, or loads them from a file inside the bundle — JSON or YAML:

when {
params {
load("$baseDir/tests/params.yaml")
outdir = "$outputDir"
}
}

Leave process.executor, process.queue and aws.* out of nextflow.config, or set them for local runs only. GENI appends its own configuration as the last -c file of every Nextflow run, so its executor, queue and work directory always win — the same rule as Nextflow config profiles.

On GENI the tasks run on Batch and their outputs stay in the engine’s S3 work directory. nf-test’s path() helper reads only the head job’s disk, so path("s3://…") fails. Use one of these two patterns, both common in nf-core.

Pipeline and workflow tests — publish to $outputDir. publishDir runs in the head job, which downloads each published file to $outputDir, so assertions and snapshots on it work unchanged:

nextflow_pipeline {
name "rnaseq"
script "../main.nf"
tag "pipeline"
test("quantifies the test sample") {
when {
params {
load("$baseDir/tests/params.yaml")
outdir = "$outputDir"
}
}
then {
assert workflow.success
assert snapshot(getAllFilesFromPath(params.outdir)).match()
}
}
}

Process tests — download with nft-utils. Shape, count, process.success and process.trace assertions need nothing else. To check content, download the file first with nft-utils’ downloadFromS3:

then {
assert process.success
assert process.out.bam.size() == 1
def bam = process.out.bam[0]
def local = new File(bam).exists() ? bam : downloadFromS3("s3:/" + bam).toString()
assert path(local).exists()
}

Plugins declared in nf-test.config (such as nft-utils) are downloaded at the start of every run, from the nf-test plugin registry and GitHub releases. The head job reaches them through the environment’s NAT gateway, so a network that blocks outbound internet access fails the run before any test starts.

Snapshot files (*.nf.test.snap) live next to the tests and are compared, not rewritten, when they exist. After every run GENI copies each snapshot file in the bundle — new and updated ones included — to <output>/snapshots/, keeping its path:

Terminal window
aws s3 cp --recursive s3://lab-tests/rnaseq/1.4.0/snapshots/ .

Commit them to your repository and register them with the next workflow version. After an intentional output change, run once with --update-snapshot and collect the new files the same way.

GENI reports only whether the run passed. Everything else is in the output folder, written whether the suite passed or failed:

Path Contents
report.xml JUnit XML, one <testcase> per test — what CI tools read
report.tap, report.csv The same results as TAP and CSV
nf-test.log nf-test’s console output, including every Nextflow run
tests/<hash>/meta/ Each test’s Nextflow log, trace and serialized outputs
tests/<hash>/output/ What each pipeline or workflow test published to $outputDir
snapshots/ The snapshot files, as above

If report.xml is missing, the suite never started — usually a bundle without main.nf or nf-test.config at its root, or a plugin that could not be downloaded. The head job’s log is in your account, in the engine’s CloudWatch log group /aws/batch/job/geni-engine-<engine-short-id>/submissions (kept for 30 days); geni test get <test-id> --format json shows its logStreamName and the statusReason.

Every test runs one Nextflow process on the head job, one after another. The head job defaults to 1 vCPU and 2 GiB; give it more with --required-cpu and --required-mem-gb when the suite has several pipeline tests or large published outputs. It runs on Fargate, so memory must pair with the vCPU count:

--required-cpu --required-mem-gb
0.25 0.5, 1, 2
0.5 1 – 4
1 2 – 8
2 4 – 16
4 8 – 30
8 16 – 60, in steps of 4
16 32 – 120, in steps of 8
Terminal window
geni test create ... --required-cpu 2 --required-mem-gb 4

The tasks themselves run on your queue’s instances and are sized by the workflow’s own cpus and memory directives, as in a submission.

  • No per-test timeout. Tests run sequentially; the run’s duration is the sum of its Nextflow runs. Stop a stuck run with geni test cancel.
  • No retry or resume. Create a new run.
  • No alert or auto-cancel timers, and no work-directory expiry tags: the work files expire by the engine bucket’s lifecycle rule.
  • No per-test cost or task view. The tasks a test run starts are not listed by geni task list, and their cost is reported against the engine and queue, not the run.
  • Nextflow on AWS only. No Cromwell/WDL, no GCP, and no test page in the web console yet.

Tell us which of these gets in your way — they were left out until there is feedback to shape them.