Skip to content

Commit

Permalink
Add test with workflow.out and snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
lukfor committed Aug 28, 2023
1 parent 52fd176 commit d7ced88
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/test/java/com/askimed/nf/test/lang/WorkflowTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ public void testWorkflowSucces() throws Exception {

}

@Test
public void testWorkflowAndSnapshot() throws Exception {

App app = new App();
int exitCode = app.run(new String[] { "test", "test-data/workflow/default/trial.snapshot.nf.test" });
assertEquals(0, exitCode);

}

@Test
public void testWorkflowWithNoOutputs() throws Exception {

Expand Down
25 changes: 25 additions & 0 deletions test-data/workflow/default/trial.snapshot.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
nextflow_workflow {

name "Test workflow"
script "test-data/workflow/default/trial.nf"
workflow "trial"

test("Should run without failures") {
when {
params {
outdir = "tests/results"
}
workflow {
"""
input[0] = Channel.of('a','b')
"""
}
}

then {
//check if test case succeeded
assert workflow.success
assert snapshot(workflow.out).match()
}
}
}
25 changes: 25 additions & 0 deletions test-data/workflow/default/trial.snapshot.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"Should run without failures": {
"content": [
{
"0": [
"a",
"b"
],
"1": [
"a.txt:md5,0cc175b9c0f1b6a831c399e269772661",
"b.txt:md5,92eb5ffee6ae2fec3ad71c777531578f"
],
"lukas": [
"a",
"b"
],
"sebastian": [
"a.txt:md5,0cc175b9c0f1b6a831c399e269772661",
"b.txt:md5,92eb5ffee6ae2fec3ad71c777531578f"
]
}
],
"timestamp": "2023-08-28T14:23:59+0000"
}
}

0 comments on commit d7ced88

Please sign in to comment.