Skip to content

Commit

Permalink
create tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maxulysse committed Oct 11, 2024
1 parent 4c58044 commit b096e05
Show file tree
Hide file tree
Showing 15 changed files with 268 additions and 128 deletions.
19 changes: 19 additions & 0 deletions nf-test.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
config {
// location for all nf-tests
testsDir "."

// nf-test directory including temporary files for each test
workDir ".nf-test"

// location of an optional nextflow.config file specific for executing tests
configFile "conf/test.config"

// run all test with defined profile(s) from the main nextflow.config
profile "test"

// Include plugins
plugins {
load "[email protected]"
load "[email protected]"
}
}
9 changes: 9 additions & 0 deletions tests/.nftignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
multiqc/multiqc_data/multiqc.log
multiqc/multiqc_data/multiqc_data.json
multiqc/multiqc_data/multiqc_general_stats.txt
multiqc/multiqc_data/multiqc_software_versions.txt
multiqc/multiqc_data/multiqc_sources.txt
multiqc/multiqc_data/picard_deduplication.txt
multiqc/multiqc_plots/{svg,pdf,png}/*.{svg,pdf,png}
multiqc/multiqc_report.html
pipeline_info/*.{html,json,txt,yml}
97 changes: 97 additions & 0 deletions tests/annotation.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
nextflow_pipeline {

name "Test pipeline | annotation"
script "../main.nf"
tag "pipeline"
tag "pipeline_rnavar"

test("Run with profile test | annotation with snpeff") {

when {
params {
modules_testdata_base_path = 'https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/'
outdir = "$outputDir"
annotate_tools = 'snpeff'
download_cache = true
}
}

then {
// stable_name: All files + folders in ${params.outdir}/ with a stable name
def stable_name = getAllFilesFromDir(params.outdir, relative: true, includeDir: true, ignore: ['pipeline_info/*.{html,json,txt}'])
// stable_path: All files in ${params.outdir}/ with stable content
def stable_path = getAllFilesFromDir(params.outdir, ignoreFile: 'tests/.nftignore')
assertAll(
{ assert workflow.success},
{ assert snapshot(
// Number of successful tasks
workflow.trace.succeeded().size(),
// pipeline versions.yml file for multiqc from which Nextflow version is removed because we tests pipelines on multiple Nextflow versions
removeNextflowVersion("$outputDir/pipeline_info/nf_core_rnavar_software_mqc_versions.yml"),
// All stable path name, with a relative path
stable_name
).match() }
)
}
}

test("Run with profile test | annotation with vep") {

when {
params {
modules_testdata_base_path = 'https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/'
outdir = "$outputDir"
annotate_tools = 'vep'
download_cache = true
}
}

then {
// stable_name: All files + folders in ${params.outdir}/ with a stable name
def stable_name = getAllFilesFromDir(params.outdir, relative: true, includeDir: true, ignore: ['pipeline_info/*.{html,json,txt}'])
// stable_path: All files in ${params.outdir}/ with stable content
def stable_path = getAllFilesFromDir(params.outdir, ignoreFile: 'tests/.nftignore')
assertAll(
{ assert workflow.success},
{ assert snapshot(
// Number of successful tasks
workflow.trace.succeeded().size(),
// pipeline versions.yml file for multiqc from which Nextflow version is removed because we tests pipelines on multiple Nextflow versions
removeNextflowVersion("$outputDir/pipeline_info/nf_core_rnavar_software_mqc_versions.yml"),
// All stable path name, with a relative path
stable_name
).match() }
)
}
}

test("Run with profile test | annotation with merge") {

when {
params {
modules_testdata_base_path = 'https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/'
outdir = "$outputDir"
annotate_tools = 'merge'
download_cache = true
}
}

then {
// stable_name: All files + folders in ${params.outdir}/ with a stable name
def stable_name = getAllFilesFromDir(params.outdir, relative: true, includeDir: true, ignore: ['pipeline_info/*.{html,json,txt}'])
// stable_path: All files in ${params.outdir}/ with stable content
def stable_path = getAllFilesFromDir(params.outdir, ignoreFile: 'tests/.nftignore')
assertAll(
{ assert workflow.success},
{ assert snapshot(
// Number of successful tasks
workflow.trace.succeeded().size(),
// pipeline versions.yml file for multiqc from which Nextflow version is removed because we tests pipelines on multiple Nextflow versions
removeNextflowVersion("$outputDir/pipeline_info/nf_core_rnavar_software_mqc_versions.yml"),
// All stable path name, with a relative path
stable_name
).match() }
)
}
}
}
36 changes: 36 additions & 0 deletions tests/bam_csi.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
nextflow_pipeline {

name "Test pipeline | bam_csi_index"
script "../main.nf"
tag "pipeline"
tag "pipeline_rnavar"

test("Run with profile test | bam_csi_index") {

when {
params {
modules_testdata_base_path = 'https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/'
outdir = "$outputDir"
bam_csi_index = true
}
}

then {
// stable_name: All files + folders in ${params.outdir}/ with a stable name
def stable_name = getAllFilesFromDir(params.outdir, relative: true, includeDir: true, ignore: ['pipeline_info/*.{html,json,txt}'])
// stable_path: All files in ${params.outdir}/ with stable content
def stable_path = getAllFilesFromDir(params.outdir, ignoreFile: 'tests/.nftignore')
assertAll(
{ assert workflow.success},
{ assert snapshot(
// Number of successful tasks
workflow.trace.succeeded().size(),
// pipeline versions.yml file for multiqc from which Nextflow version is removed because we tests pipelines on multiple Nextflow versions
removeNextflowVersion("$outputDir/pipeline_info/nf_core_rnavar_software_mqc_versions.yml"),
// All stable path name, with a relative path
stable_name
).match() }
)
}
}
}
35 changes: 0 additions & 35 deletions tests/config/nextflow.config

This file was deleted.

4 changes: 0 additions & 4 deletions tests/config/pytest_software.yml

This file was deleted.

15 changes: 0 additions & 15 deletions tests/config/test_data.config

This file was deleted.

35 changes: 35 additions & 0 deletions tests/default.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
nextflow_pipeline {

name "Test pipeline"
script "../main.nf"
tag "pipeline"
tag "pipeline_rnavar"

test("Run with profile test") {

when {
params {
modules_testdata_base_path = 'https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/'
outdir = "$outputDir"
}
}

then {
// stable_name: All files + folders in ${params.outdir}/ with a stable name
def stable_name = getAllFilesFromDir(params.outdir, relative: true, includeDir: true, ignore: ['pipeline_info/*.{html,json,txt}'])
// stable_path: All files in ${params.outdir}/ with stable content
def stable_path = getAllFilesFromDir(params.outdir, ignoreFile: 'tests/.nftignore')
assertAll(
{ assert workflow.success},
{ assert snapshot(
// Number of successful tasks
workflow.trace.succeeded().size(),
// pipeline versions.yml file for multiqc from which Nextflow version is removed because we tests pipelines on multiple Nextflow versions
removeNextflowVersion("$outputDir/pipeline_info/nf_core_rnavar_software_mqc_versions.yml"),
// All stable path name, with a relative path
stable_name
).match() }
)
}
}
}
36 changes: 36 additions & 0 deletions tests/removeduplicates.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
nextflow_pipeline {

name "Test pipeline | remove_duplicates"
script "../main.nf"
tag "pipeline"
tag "pipeline_rnavar"

test("Run with profile test | remove_duplicates") {

when {
params {
modules_testdata_base_path = 'https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/'
outdir = "$outputDir"
remove_duplicates = true
}
}

then {
// stable_name: All files + folders in ${params.outdir}/ with a stable name
def stable_name = getAllFilesFromDir(params.outdir, relative: true, includeDir: true, ignore: ['pipeline_info/*.{html,json,txt}'])
// stable_path: All files in ${params.outdir}/ with stable content
def stable_path = getAllFilesFromDir(params.outdir, ignoreFile: 'tests/.nftignore')
assertAll(
{ assert workflow.success},
{ assert snapshot(
// Number of successful tasks
workflow.trace.succeeded().size(),
// pipeline versions.yml file for multiqc from which Nextflow version is removed because we tests pipelines on multiple Nextflow versions
removeNextflowVersion("$outputDir/pipeline_info/nf_core_rnavar_software_mqc_versions.yml"),
// All stable path name, with a relative path
stable_name
).match() }
)
}
}
}
36 changes: 36 additions & 0 deletions tests/skip_baserecalibration.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
nextflow_pipeline {

name "Test pipeline | skip_baserecalibration"
script "../main.nf"
tag "pipeline"
tag "pipeline_rnavar"

test("Run with profile test | skip_baserecalibration") {

when {
params {
modules_testdata_base_path = 'https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/'
outdir = "$outputDir"
skip_baserecalibration = true
}
}

then {
// stable_name: All files + folders in ${params.outdir}/ with a stable name
def stable_name = getAllFilesFromDir(params.outdir, relative: true, includeDir: true, ignore: ['pipeline_info/*.{html,json,txt}'])
// stable_path: All files in ${params.outdir}/ with stable content
def stable_path = getAllFilesFromDir(params.outdir, ignoreFile: 'tests/.nftignore')
assertAll(
{ assert workflow.success},
{ assert snapshot(
// Number of successful tasks
workflow.trace.succeeded().size(),
// pipeline versions.yml file for multiqc from which Nextflow version is removed because we tests pipelines on multiple Nextflow versions
removeNextflowVersion("$outputDir/pipeline_info/nf_core_rnavar_software_mqc_versions.yml"),
// All stable path name, with a relative path
stable_name
).match() }
)
}
}
}
27 changes: 0 additions & 27 deletions tests/test_annotation.yml

This file was deleted.

10 changes: 0 additions & 10 deletions tests/test_bamcsiindex.yml

This file was deleted.

13 changes: 0 additions & 13 deletions tests/test_default.yml

This file was deleted.

13 changes: 0 additions & 13 deletions tests/test_removeduplicates.yml

This file was deleted.

Loading

0 comments on commit b096e05

Please sign in to comment.