Skip to content

Params Dictionary

The params block is optional and is a simple map that can be used to overwrite Nextflow's input params. The params block is located in the when block of a testcase. You can set params manually:

when {
    params {
        outdir = "output"
    }
}

It is also possible to set nested params using the same syntax as in your Nextflow script:

when {
    params {
        output {
          dir = "output"
        }
    }
}

The params map can also be used in the then block:

then {
    assert params.output == "output"    
}

Load params from files

In addition, you can load the params from a JSON file:

when {
    params {
        load("$baseDir/tests/params.json")
    }
}

or from a YAML file:

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

nf-test allows to combine both techniques and therefor it is possible to overwrite one or more params from the json file:

when {
    params {
        load("$baseDir/tests/params.json")
        outputDir = "new/output/path"
    }
}