Skip to content

Implementation of topics channel testing for processes and workflows#355

Merged
nvnieuwk merged 9 commits intoaskimed:mainfrom
nvnieuwk:topics-integration
Mar 17, 2026
Merged

Implementation of topics channel testing for processes and workflows#355
nvnieuwk merged 9 commits intoaskimed:mainfrom
nvnieuwk:topics-integration

Conversation

@nvnieuwk
Copy link
Collaborator

@nvnieuwk nvnieuwk commented Mar 13, 2026

This PR implements the long awaited support for topic channels in process and workflow tests.

Currently this PR is not complete, I will update the following list whenever some new steps are done, but feel free to test this branch out already!

  • Implement topic channels testing for processes
  • Implement topic channels testing for workflows
  • Add tests for this feature
  • Update the documentation

You can test the topic channels in the following way:

nextflow_process {
    name "Test Process TEST"
    script "main.nf"
    process "TEST"

    topics 'test', 'other' // Define topics to be checked for for all tests in this test file
    test("Should run without failures") {

        topics 'another' // Define topics to be checked for in this test only (this expands the topics defined in the upper scope)

        when {
            process {
                """
                input[0] = "test"
                """
            }
        }
        then {
            assert process.success
            assert snapshot(topics).match() // the 'topics' property functions the same as the 'process.out' property, meaning that you can access the specific topics using 'topic.<key>' or 'topic.get("<key>")' or 'topic["<key>"]'
        }
    }
}

Any feedback would be greatly appreciated! If you need a compiled jar file of this branch, feel free to ask me :)

@nvnieuwk nvnieuwk linked an issue Mar 13, 2026 that may be closed by this pull request
@nvnieuwk
Copy link
Collaborator Author

An example snapshot from topics looks like this:

{
    "Should run without failures": {
        "content": [
            {
                "another": [
                    
                ],
                "other": [
                    
                ],
                "test": [
                    "test.txt:md5,e4439267203fb5277d347e6cd6e440b5"
                ]
            }
        ],
        "timestamp": "2026-03-13T15:49:49.276661043",
        "meta": {
            "nf-test": "0.9.4",
            "nextflow": "25.10.4"
        }
    }
}

This is for a process that has one output topic called test

@nvnieuwk nvnieuwk requested a review from lukfor March 16, 2026 09:48
@nvnieuwk nvnieuwk marked this pull request as ready for review March 16, 2026 09:57
Copy link
Collaborator

@maxulysse maxulysse left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@lukfor lukfor left a comment

Choose a reason for hiding this comment

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

Great work! 👍👌

@nvnieuwk nvnieuwk merged commit 76de7f4 into askimed:main Mar 17, 2026
8 checks passed
@nvnieuwk nvnieuwk deleted the topics-integration branch March 17, 2026 08:10
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.

Support for topic channels

3 participants