Skip to content

Commit e2d72b3

Browse files
committed
Add solutions
1 parent eeb1f0a commit e2d72b3

File tree

6 files changed

+120
-0
lines changed

6 files changed

+120
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
nextflow_process {
2+
3+
name "Test Process convertToUpper"
4+
script "main.nf"
5+
process "convertToUpper"
6+
7+
test("Should run without failures") {
8+
9+
when {
10+
params {
11+
// define parameters here. Example:
12+
// outdir = "tests/results"
13+
}
14+
process {
15+
"""
16+
input[0] = "${projectDir}/greetings.csv"
17+
"""
18+
}
19+
}
20+
21+
then {
22+
assert process.success
23+
assert snapshot(process.out).match()
24+
}
25+
26+
}
27+
28+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"Should run without failures": {
3+
"content": [
4+
{
5+
"0": [
6+
"UPPER-greetings.csv:md5,f36624b0e040fa880e61fb1304b4b6b9"
7+
]
8+
}
9+
],
10+
"meta": {
11+
"nf-test": "0.9.2",
12+
"nextflow": "24.10.0"
13+
},
14+
"timestamp": "2025-02-19T11:57:20.215132756"
15+
}
16+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
nextflow_pipeline {
2+
3+
name "Test Workflow main.nf"
4+
script "main.nf"
5+
6+
test("Should run without failures") {
7+
8+
when {
9+
params {
10+
input_file = "${projectDir}/greetings.csv"
11+
}
12+
}
13+
14+
then {
15+
assert workflow.success
16+
assert workflow.trace.tasks().size() == 6
17+
assert file("$launchDir/results/Bonjour-output.txt").exists()
18+
assert file("$launchDir/results/Hello-output.txt").exists()
19+
assert file("$launchDir/results/Holà-output.txt").exists()
20+
assert file("$launchDir/results/UPPER-Bonjour-output.txt").exists()
21+
assert file("$launchDir/results/UPPER-Hello-output.txt").exists()
22+
assert file("$launchDir/results/UPPER-Holà-output.txt").exists()
23+
}
24+
25+
}
26+
27+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
nextflow_process {
2+
3+
name "Test Process sayHello"
4+
script "main.nf"
5+
process "sayHello"
6+
7+
test("Should run without failures") {
8+
9+
when {
10+
params {
11+
// define parameters here. Example:
12+
// outdir = "tests/results"
13+
}
14+
process {
15+
"""
16+
input[0] = "hello"
17+
"""
18+
}
19+
}
20+
21+
then {
22+
assert process.success
23+
assert snapshot(process.out).match()
24+
}
25+
26+
}
27+
28+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"Should run without failures": {
3+
"content": [
4+
{
5+
"0": [
6+
"hello-output.txt:md5,b1946ac92492d2347c6235b4d2611184"
7+
]
8+
}
9+
],
10+
"meta": {
11+
"nf-test": "0.9.2",
12+
"nextflow": "24.10.0"
13+
},
14+
"timestamp": "2025-02-19T11:52:09.690504479"
15+
}
16+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/*
2+
========================================================================================
3+
Nextflow config file for running tests
4+
========================================================================================
5+
*/

0 commit comments

Comments
 (0)