From 8a19929d03832ecaf95a50962898882de04e6884 Mon Sep 17 00:00:00 2001 From: Adrien Coulier Date: Fri, 3 May 2024 09:50:42 +0200 Subject: [PATCH] Set up tests --- .gitignore | 1 + nf-test.config | 8 ++++++++ tests/main.nf.test | 20 +++++++++++++++++++ tests/nextflow.config | 5 +++++ tests/workflows/seqinspector.nf.test | 30 ++++++++++++++++++++++++++++ 5 files changed, 64 insertions(+) create mode 100644 nf-test.config create mode 100644 tests/main.nf.test create mode 100644 tests/nextflow.config create mode 100644 tests/workflows/seqinspector.nf.test diff --git a/.gitignore b/.gitignore index 5124c9a..089a407 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ results/ testing/ testing* *.pyc +.nf-test diff --git a/nf-test.config b/nf-test.config new file mode 100644 index 0000000..6969c08 --- /dev/null +++ b/nf-test.config @@ -0,0 +1,8 @@ +config { + + testsDir "tests" + workDir ".nf-test" + configFile "tests/nextflow.config" + profile "test,docker" + +} diff --git a/tests/main.nf.test b/tests/main.nf.test new file mode 100644 index 0000000..72498b5 --- /dev/null +++ b/tests/main.nf.test @@ -0,0 +1,20 @@ +nextflow_pipeline { + + name "Test Workflow main.nf" + script "main.nf" + + test("Should run without failures") { + + when { + params { + outdir = "tests/results" + } + } + + then { + assert workflow.success + } + + } + +} diff --git a/tests/nextflow.config b/tests/nextflow.config new file mode 100644 index 0000000..c19b1ad --- /dev/null +++ b/tests/nextflow.config @@ -0,0 +1,5 @@ +/* +======================================================================================== + Nextflow config file for running tests +======================================================================================== +*/ diff --git a/tests/workflows/seqinspector.nf.test b/tests/workflows/seqinspector.nf.test new file mode 100644 index 0000000..bbb529d --- /dev/null +++ b/tests/workflows/seqinspector.nf.test @@ -0,0 +1,30 @@ +nextflow_workflow { + + name "Test Workflow SEQINSPECTOR" + script "workflows/seqinspector.nf" + workflow "SEQINSPECTOR" + + test("Should run without failures pipeline") { + + when { + params { + // define parameters here. Example: + // outdir = "tests/results" + } + workflow { + """ + // define inputs of the workflow here. Example: + // input[0] = file("https://raw.githubusercontent.com/nf-core/test-datasets/e47966b63444ec0fcdef23bfc410eeca22535ac7/testdata/MiSeq/samplesheet.csv") + input[0] = file("assets/samplesheet.csv") + """ + } + } + + then { + assert workflow.success + assert snapshot(workflow.out).match() + } + + } + +}