Skip to content

Conversation

sateeshperi
Copy link
Contributor

@sateeshperi sateeshperi commented Aug 21, 2025

03 - testing modules
04 - testing subworkflows

@netlify /docs/tutorials/tests_and_test_data/components/03_testing_modules

03 - testing modules
04 - testing subworkflows
Copy link

netlify bot commented Aug 21, 2025

Deploy Preview for nf-core-docs ready!

Name Link
🔨 Latest commit 20de5ab
🔍 Latest deploy log https://app.netlify.com/projects/nf-core-docs/deploys/68a9ae2c1dd5990008258056
😎 Deploy Preview https://deploy-preview-3474--nf-core-docs.netlify.app/docs/tutorials/tests_and_test_data/components/03_testing_modules
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

netlify bot commented Aug 21, 2025

Deploy Preview for nf-core-main-site ready!

Name Link
🔨 Latest commit 20de5ab
🔍 Latest deploy log https://app.netlify.com/projects/nf-core-main-site/deploys/68a9ae2c66f6020008c5f607
😎 Deploy Preview https://deploy-preview-3474--nf-core-main-site.netlify.app/docs/tutorials/tests_and_test_data/components/03_testing_modules
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@sateeshperi sateeshperi marked this pull request as draft August 22, 2025 06:52
- Updated titles and subtitles for clarity.
- Enhanced descriptions of testing processes and principles.
- Improved syntax examples and added comments for better understanding.
- Clarified the use of setup blocks and input parameters in tests.
- Emphasized the importance of MD5 checksums for BAM file testing.
- Clarified the relationship between module and subworkflow testing concepts.
- Expanded on the use of `params` blocks for parameter management in tests.
- Added examples for loading parameters from files and combining techniques.
- Improved explanations of setup blocks for handling dependencies in subworkflows.
- Updated essential assertions and testing principles for better comprehension.
@sateeshperi sateeshperi marked this pull request as ready for review August 23, 2025 17:19

### Basic test syntax

The basic syntax for a process test follows this structure:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would start by mentioning the file structure of a module.

Your previous chapter only really focused on pipeline level tests, not modules


The basic syntax for a process test follows this structure:

```groovy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```groovy
```groovy title="main.nf.test"

Or whatever we call it


### Essential Assertions

Tests use assertions to verify the expected output of the process in the `then` block.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Tests use assertions to verify the expected output of the process in the `then` block.
Tests use assertions to verify the expected output of the process specified in the `then` block.


Tests use assertions to verify the expected output of the process in the `then` block.

To report multiple failures in a single test run, group your assertions within an `assertAll` block.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To report multiple failures in a single test run, group your assertions within an `assertAll` block.
You can specify multiple assertions to be evaluated together in a single test by specifying them within an `assertAll` block.

I don't understand this, why are you tracking failures?


To report multiple failures in a single test run, group your assertions within an `assertAll` block.

Channels that lack explicit names can be addressed using square brackets and the corresponding index, for example `process.out[0]` for the first channel. This indexing method provides a straightforward way to interact with channels without the need for predefined names.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Channels that lack explicit names can be addressed using square brackets and the corresponding index, for example `process.out[0]` for the first channel. This indexing method provides a straightforward way to interact with channels without the need for predefined names.
Nextflow process output channels that lack explicit names can be addressed using square brackets and the corresponding index, for example `process.out[0]` for the first channel. This indexing method provides a straightforward way to interact with channels without the need for predefined names.

But what if you have meta/file tuples? If you describe this later on, I would have a link down to it at the bottom


## Testing parameter variations

Test different parameter combinations that affect subworkflow behavior:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Test different parameter combinations that affect subworkflow behavior:
You should make sure to test different parameter combinations that could affect subworkflow behavior.
You can do this with nextflow config files that sit alongside the `main.nf.test` file.


### Overriding parameters with the `params` block

In addition to a `nextflow.config` file, `nf-test` provides a `params` block within the `when` block to override Nextflow's input `params` for a specific test. This is useful for testing different parameter combinations without creating multiple config files.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In addition to a `nextflow.config` file, `nf-test` provides a `params` block within the `when` block to override Nextflow's input `params` for a specific test. This is useful for testing different parameter combinations without creating multiple config files.
In addition to a `nextflow.config` file, `nf-test` provides a `params` block within the `when` block to override Nextflow's input `params` for a specific test.
This is useful for testing different parameter combinations without creating multiple config files.

Again I would pick one method and stick wit hit

Comment on lines +250 to +252
output {
dir = "output"
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this for?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe give a more realiastic example likthe bismark in the example above


#### Loading parameters from a file

You can also load parameters from a JSON or YAML file. This is useful for managing complex parameter sets.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What sor tof JSON/YAML file, you mean a nextflow one?


## Testing output channels comprehensively

### BAM file testing with MD5 checksums
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you singling out BAMs here? Also this is using a plugin not mentioned her yet.

I think these two sections make more sense for the assertion chaper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants