Skip to content

Pipeline Testing

nf-test also allows to test the complete pipeline end-to-end. Please checkout the CLI to generate a pipeline test.


nextflow_pipeline {

    name "<NAME>"
    script "<PATH/TO/>"

    test("<TEST_NAME>") {



The workflow object can be used in asserts to check its status, error messages or traces.

// workflow status
assert workflow.success
assert workflow.failed
assert workflow.exitStatus == 0

// workflow error message
assert workflow.errorReport.contains("....")

// trace
//returns a list containing succeeded tasks
assert workflow.trace.succeeded().size() == 3

//returns a list containing failed tasks
assert workflow.trace.failed().size() == 0

//returns a list containing all tasks
assert workflow.trace.tasks().size() == 3


Nextflow script

Create a new file and name it

#!/usr/bin/env nextflow

process SAY_HELLO {
        val cheers

        stdout emit: verbiage_ch
        path '*.txt', emit: verbiage_ch2

    echo -n $cheers
    echo -n $cheers > ${cheers}.txt

workflow {
    input = params.input_text.trim().split(',')
    Channel.from(input) | SAY_HELLO

nf-test script

Create a new file and name it

nextflow_pipeline {

    name "Test Pipeline with 1 process"
    script ""

    test("Should run without failures") {

        when {
            params {
              input_text = "hello,nf-test"

        then {
            assert workflow.success
            assert workflow.trace.tasks().size() == 2



Execute test

nf-test init
nf-test test