Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
f9329fa
Porting nf-test intro to new structure
adamrtalbot Feb 17, 2025
b015e77
update nf-test side quest
pinin4fjords Feb 19, 2025
eeb1f0a
add summary
pinin4fjords Feb 19, 2025
e2d72b3
Add solutions
pinin4fjords Feb 19, 2025
499dfc1
Add side quests to menu
pinin4fjords Feb 19, 2025
e8a976a
prettier
pinin4fjords Feb 19, 2025
b67bbda
Add newlines
pinin4fjords Feb 19, 2025
eae10e4
Fix gitpod references
pinin4fjords Feb 19, 2025
5256459
Add note on verbose
pinin4fjords Feb 19, 2025
2e94299
Fix nf-test version
pinin4fjords Feb 19, 2025
474bf46
prettier
pinin4fjords Feb 19, 2025
92ee366
Update docs/side_quests/nf-test.md
adamrtalbot Feb 19, 2025
61ea24b
Add things on naming
pinin4fjords Feb 25, 2025
b92a424
Add a content checking example
pinin4fjords Feb 26, 2025
16cea78
Add multiple test explanation
pinin4fjords Feb 26, 2025
73ed381
unit testing -> testing
pinin4fjords Feb 26, 2025
1068b13
fix reference to testing in other modules
pinin4fjords Feb 26, 2025
fa0d380
Fix inconsistencies
pinin4fjords Feb 26, 2025
76f00f2
Merge branch 'master' into nftest_bits
pinin4fjords Feb 26, 2025
4d4d3b9
Merge branch 'nftest_bits' of github.com:nextflow-io/training into nf…
pinin4fjords Feb 26, 2025
eb2c2d8
Prettier
pinin4fjords Feb 26, 2025
ebe4b23
Tweak intro
pinin4fjords Feb 26, 2025
0c0eee6
Prettier
pinin4fjords Feb 26, 2025
5b2dd8f
Revert "Prettier"
pinin4fjords Feb 26, 2025
558d569
Revert "Tweak intro"
pinin4fjords Feb 26, 2025
7d67104
Minor tweaks and fixes
pinin4fjords Feb 26, 2025
0c3f82b
Fix typo
mribeirodantas Feb 26, 2025
a892610
Apply suggestions from code review
pinin4fjords Feb 26, 2025
3c1bbe5
Correct back reference to Hello World
pinin4fjords Feb 26, 2025
8dff7a1
Update docs/side_quests/nf-test.md
pinin4fjords Feb 26, 2025
382693f
Update docs/side_quests/nf-test.md
pinin4fjords Feb 26, 2025
debf29c
Update docs/side_quests/nf-test.md
pinin4fjords Feb 26, 2025
da64c2a
Remove manual section numberings clashing with mkdocs
pinin4fjords Feb 26, 2025
86e4f1c
Merge branch 'nftest_bits' of github.com:nextflow-io/training into nf…
pinin4fjords Feb 26, 2025
41255b0
Reset heading levels to try and fix mkdocs numbering
pinin4fjords Feb 26, 2025
764e88b
Revert "Reset heading levels to try and fix mkdocs numbering"
pinin4fjords Feb 26, 2025
c5cda60
Revert "Remove manual section numberings clashing with mkdocs"
pinin4fjords Feb 26, 2025
bfb75f0
Update docs/side_quests/nf-test.md
pinin4fjords Feb 26, 2025
01abaf0
Improve code block comparison
mribeirodantas Feb 27, 2025
b958086
Exclude side quests from auto header numbering
pinin4fjords Feb 27, 2025
073cdf8
Merge branch 'master' into nftest_bits
mribeirodantas Feb 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,121 changes: 1,121 additions & 0 deletions docs/side_quests/nf-test.md

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ nav:
- hello_nextflow/04_hello_modules.md
- hello_nextflow/05_hello_containers.md
- hello_nextflow/06_hello_config.md
- Side Quests:
- side_quests/nf-test.md
- hello_nextflow/survey.md
- hello_nextflow/next_steps.md
- Nextflow for Genomics:
Expand Down Expand Up @@ -173,6 +175,7 @@ plugins:
- basic_training/orientation.md
- advanced/index.md
- advanced/orientation.md
- side_quests/nf-test.md
- i18n:
docs_structure: suffix
fallback_to_default: true
Expand Down
3 changes: 3 additions & 0 deletions side-quests/nf-test/greetings.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Hello
Bonjour
Holà
56 changes: 56 additions & 0 deletions side-quests/nf-test/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env nextflow

/*
* Pipeline parameters
*/
params.input_file = "greetings.csv"

/*
* Use echo to print 'Hello World!' to standard out
*/
process sayHello {

publishDir 'results', mode: 'copy'

input:
val greeting

output:
path "${greeting}-output.txt"

script:
"""
echo '$greeting' > '$greeting-output.txt'
"""
}

/*
* Use a text replace utility to convert the greeting to uppercase
*/
process convertToUpper {

publishDir 'results', mode: 'copy'

input:
path input_file

output:
path "UPPER-${input_file}"

script:
"""
cat '$input_file' | tr '[a-z]' '[A-Z]' > UPPER-${input_file}
"""
}

workflow {

// create a channel for inputs from a CSV file
greeting_ch = Channel.fromPath(params.input_file).splitCsv().flatten()

// emit a greeting
sayHello(greeting_ch)

// convert the greeting to uppercase
convertToUpper(sayHello.out)
}
28 changes: 28 additions & 0 deletions side-quests/solutions/nf-test/tests/main.converttoupper.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
nextflow_process {

name "Test Process convertToUpper"
script "main.nf"
process "convertToUpper"

test("Should run without failures and produce correct output") {

when {
params {
// define parameters here. Example:
// outdir = "tests/results"
}
process {
"""
input[0] = "${projectDir}/greetings.csv"
"""
}
}

then {
assert process.success
assert snapshot(process.out).match()
}

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"Should run without failures": {
"content": [
{
"0": [
"UPPER-greetings.csv:md5,f36624b0e040fa880e61fb1304b4b6b9"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.0"
},
"timestamp": "2025-02-19T11:57:20.215132756"
}
}
39 changes: 39 additions & 0 deletions side-quests/solutions/nf-test/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
nextflow_pipeline {

name "Test Workflow main.nf"
script "main.nf"

test("Should run without failures") {

when {
params {
input_file = "${projectDir}/greetings.csv"
}
}

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

}

test("Should produce correct output files") {

when {
params {
input_file = "${projectDir}/greetings.csv"
}
}

then {
assert file("$launchDir/results/Bonjour-output.txt").exists()
assert file("$launchDir/results/Hello-output.txt").exists()
assert file("$launchDir/results/Holà-output.txt").exists()
assert file("$launchDir/results/UPPER-Bonjour-output.txt").exists()
assert file("$launchDir/results/UPPER-Hello-output.txt").exists()
assert file("$launchDir/results/UPPER-Holà-output.txt").exists()
}

}
}
26 changes: 26 additions & 0 deletions side-quests/solutions/nf-test/tests/main.sayhello.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
nextflow_process {

name "Test Process sayHello"
script "main.nf"
process "sayHello"

test("Should run without failures and contain expected greeting") {
when {
params {
// define parameters here
}
process {
"""
input[0] = "hello"
"""
}
}

then {
assert process.success
assert path(process.out[0][0]).readLines().contains('hello')
assert !path(process.out[0][0]).readLines().contains('HELLO')
}
}

}
5 changes: 5 additions & 0 deletions side-quests/solutions/nf-test/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*
========================================================================================
Nextflow config file for running tests
========================================================================================
*/