You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/side_quests/nf-test.md
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ In this part of the training, we're going to show you how to use nf-test to writ
31
31
32
32
---
33
33
34
-
# Warmup
34
+
##Warmup
35
35
36
36
Let's move into the project directory.
37
37
@@ -110,7 +110,7 @@ workflow {
110
110
111
111
We're going to assume an understanding of this workflow, but if you're not sure, you can refer back to [Hello Workflow](../hello_nextflow/03_hello_workflow.md).
112
112
113
-
## Run the workflow
113
+
###Run the workflow
114
114
115
115
Let's run the workflow to make sure it's working as expected.
116
116
@@ -140,17 +140,17 @@ You ran the workflow with the default parameters, you confirmed it worked and yo
140
140
141
141
Testing software essentially does this process for us. Let's replace our simple `nextflow run main.nf` with a standardised test provided by nf-test.
142
142
143
-
## Takeaway
143
+
###Takeaway
144
144
145
145
You should be able to 'test' a pipeline by manually running it.
146
146
147
-
## What's next?
147
+
###What's next?
148
148
149
149
Initialize `nf-test`.
150
150
151
151
---
152
152
153
-
# Initialize `nf-test`
153
+
##Initialize `nf-test`
154
154
155
155
The `nf-test` package provides an initialization command that sets up a few things in order for us to start developing tests for our project.
156
156
@@ -170,7 +170,7 @@ Project configured. Configuration is stored in nf-test.config
170
170
171
171
It also creates a `tests` directory containing a configuration file stub.
172
172
173
-
# Generate a pipeline-level nf-test
173
+
##Generate an nf-test
174
174
175
175
`nf-test` comes with a set of tools for building nf-test files, saving us the majority of the work. These come under the subcommand `generate`. Let's generate a test for the pipeline:
176
176
@@ -238,7 +238,7 @@ In plain English, the logic of the test reads as follows:
238
238
239
239
This isn't a functional test, we will demonstrate how to turn it into one in the next section.
240
240
241
-
## A Note on Test Names
241
+
###A Note on Test Names
242
242
243
243
In the example above, we used the default name "Should run without failures" which is appropriate for a basic test that just checks if the pipeline runs successfully. However, as we add more specific test cases, we should use more descriptive names that indicate what we're actually testing. For example:
244
244
@@ -556,21 +556,21 @@ Success! The tests pass because the pipeline completed successfully, the correct
556
556
557
557
This is just the surface, we can keep writing assertions to check the details of the pipeline, but for now let's move on to testing the internals of the pipeline.
558
558
559
-
## Takeaway
559
+
###Takeaway
560
560
561
561
You know how to write an nf-test for a pipeline.
562
562
563
-
## What's next?
563
+
###What's next?
564
564
565
565
Learn how to test a Nextflow process.
566
566
567
567
---
568
568
569
-
# Test a Nextflow process
569
+
##Test a Nextflow process
570
570
571
571
We don't have to write tests for every part of the pipeline, but the more tests we have the more comprehensive we can be about the pipeline and the more confident we can be that it's working as expected. In this section we're going to test both processes in the pipeline as individual units.
572
572
573
-
## Test the `sayHello` process
573
+
###Test the `sayHello` process
574
574
575
575
Let's start with the `sayHello` process.
576
576
@@ -888,7 +888,7 @@ Test Process sayHello
888
888
SUCCESS: Executed 1 tests in 7.208s
889
889
```
890
890
891
-
## Test the `convertToUpper` process
891
+
###Test the `convertToUpper` process
892
892
893
893
Let's open the `tests/main.converttoupper.nf.test` file and take a look at the contents:
894
894
@@ -1034,23 +1034,23 @@ Test Process convertToUpper
1034
1034
SUCCESS: Executed 1 tests in 1.811s
1035
1035
```
1036
1036
1037
-
## Takeaway
1037
+
###Takeaway
1038
1038
1039
1039
You know how to write tests for a Nextflow process and run them.
1040
1040
1041
-
## What's next?
1041
+
###What's next?
1042
1042
1043
1043
Learn how to run tests for everything at once!
1044
1044
1045
-
# Run tests for the entire repository
1045
+
##Run tests for the entire repository
1046
1046
1047
1047
Running nf-test on each component is fine, but laborious and error prone. Can't we just test a test on everything at once?
1048
1048
1049
1049
Yes we can!
1050
1050
1051
1051
Let's run nf-test on the entire repo.
1052
1052
1053
-
## Run nf-test on the entire repo
1053
+
###Run nf-test on the entire repo
1054
1054
1055
1055
We can run nf-test on the entire repo by running the `nf-test test` command.
1056
1056
@@ -1087,7 +1087,7 @@ SUCCESS: Executed 3 tests in 5.007s
1087
1087
1088
1088
Check that out! We ran 3 tests, 1 for each process and 1 for the whole pipeline with a single command. Imagine how powerful this is on a large codebase!
1089
1089
1090
-
# Summary
1090
+
##Summary
1091
1091
1092
1092
In this side quest, we've learned:
1093
1093
@@ -1111,7 +1111,7 @@ Testing is a critical part of pipeline development that helps ensure:
1111
1111
- Problems can be identified and fixed quickly
1112
1112
- Output content matches expectations
1113
1113
1114
-
## What's next?
1114
+
###What's next?
1115
1115
1116
1116
Check out the [nf-test documentation](https://www.nf-test.com/) for more advanced testing features and best practices. You might want to:
0 commit comments