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
+7-23Lines changed: 7 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,31 +1,15 @@
1
1
# Side Quest: nf-test
2
2
3
-
Testing is a fundamental aspect of software development, and pipeline development is no exception. Being able to systematically verify that every component of your workflow behaves as intended is critical for:
4
-
- Ensuring reproducibility
5
-
- Supporting long-term maintenance
6
-
- Accelerating the development process
3
+
Being able to systematically test that every part of your workflow is doing what it's supposed to do is critical for reproducibility and long-term maintenance.
4
+
And it's also helpful during the development process!
7
5
8
-
Let's explore why testing is so important in pipeline development.
6
+
This is (hopefully) not controversial, but let's take a minute to talk about why testing is so important.
9
7
10
-
Imagine you're building a new workflow. You start by gathering some test data that you know should produce valid results. As you develop, you:
11
-
1. Add the first process to your pipeline
12
-
2. Connect it to your input data
13
-
3. Run it to verify it works
14
-
4. Move on to the next process
15
-
5. Repeat until the pipeline is complete
8
+
Let's imagine you're developing a workflow. One of the first things you will do is grab some test data that you know is valid and should produce a result. You add the first process to the pipeline and wire it up to your inputs to make it work. Then, to check it's all working, you run it on the test data. Assuming it works, you move on to the next process and run the test data again. You repeat this process until you have a pipeline that you're happy with.
16
9
17
-
This manual testing approach works initially, but quickly becomes challenging. For example, when you add a simple parameter like `--skip_process`, you now need to:
18
-
- Run the pipeline twice (once with and without the parameter)
19
-
- Manually inspect outputs or log files to verify the process was actually skipped
20
-
- Remember to repeat this verification every time you make changes
10
+
Maybe you add a simple true or false parameter such as `--skip_process`, now you must run the pipeline twice, once with each parameter to make sure it works as expected. But wait, how do we check if the `--skip_process` actually skips the process? We have to dig into the outputs or check the log files! This is a pain and prone to error.
21
11
22
-
As your pipeline grows more complex, this manual testing becomes:
23
-
- Time-consuming
24
-
- Error-prone
25
-
- Difficult to track
26
-
- Hard to debug when things go wrong
27
-
28
-
This is where systematic testing comes in.
12
+
As you develop your pipeline, it will quickly become so complex that manually testing every iteration is slow and error prone. Furthermore, if you do find an error it will be very difficult to pin down exactly where in your pipeline the error is coming from. This is where testing comes in.
29
13
30
14
Testing allows you to systematically check that every part of your pipeline is working as expected. The benefits to a developer are huge:
31
15
@@ -43,7 +27,7 @@ There are lots of different types of tests we can write:
43
27
5.**Performance tests**: For the speed and efficiency of the pipeline
44
28
6.**Stress tests**: To identify the limits of the pipeline
45
29
46
-
[**nf-test**](https://www.nf-test.com/) is a tool that allows you to write module, workflow and pipeline level tests. In short, it allows you to systematically check every individual part of the pipeline is working as expected, _in isolation_.
30
+
[**nf-test**](https://www.nf-test.com/) is a tool that allows you to write module, workflow and pipeline level test. In short, it allows you to systematically check every individual part of the pipeline is working as expected, _in isolation_.
47
31
48
32
In this part of the training, we're going to show you how to use nf-test to write module-level tests for the three processes in our pipeline.
0 commit comments