Skip to content

Commit 6b1f015

Browse files
Update Pipeline test to create valid TAP file and verify publishTap symbol
1 parent 4b3af7c commit 6b1f015

File tree

4 files changed

+40
-7
lines changed

4 files changed

+40
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ test-output/
77
**/*~
88
.idea
99
*.iml
10+
.vscode/

.vscode/settings.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ SOFTWARE.
135135
<artifactId>workflow-step-api</artifactId>
136136
<scope>test</scope>
137137
</dependency>
138+
<dependency>
139+
<groupId>org.jenkins-ci.plugins.workflow</groupId>
140+
<artifactId>workflow-basic-steps</artifactId>
141+
<scope>test</scope>
142+
</dependency>
138143
</dependencies>
139144

140145
<build>
Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,30 @@
1+
/*
2+
* The MIT License
3+
*
4+
* Copyright (c) 2010-2016 Bruno P. Kinoshita
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19+
*/
120
package org.tap4j.plugin;
221

22+
import hudson.model.Result;
323
import org.junit.Rule;
424
import org.junit.Test;
525
import org.jvnet.hudson.test.JenkinsRule;
626
import org.jenkinsci.plugins.workflow.job.WorkflowJob;
27+
import org.jenkinsci.plugins.workflow.job.WorkflowRun;
728
import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition;
829

930
public class TapPublisherPipelineTest {
@@ -12,13 +33,22 @@ public class TapPublisherPipelineTest {
1233
public JenkinsRule j = new JenkinsRule();
1334

1435
@Test
15-
public void publishTapSymbolWorks() throws Exception {
36+
public void publishTapSymbolWorksWithValidTapFile() throws Exception {
37+
1638
WorkflowJob job = j.createProject(WorkflowJob.class);
1739

1840
job.setDefinition(new CpsFlowDefinition(
19-
"publishTap(testResults: 'test.log')",
20-
true));
41+
"node {\n" +
42+
" writeFile file: 'test.log', text: '1..1\\nok 1 - Sample test\\n'\n" +
43+
" publishTap(testResults: 'test.log')\n" +
44+
"}",
45+
true
46+
));
47+
48+
WorkflowRun run = j.buildAndAssertSuccess(job);
2149

22-
j.buildAndAssertSuccess(job);
50+
j.assertBuildStatus(Result.SUCCESS, run);
51+
j.assertLogContains("TAP Reports Processing: START", run);
52+
j.assertLogContains("TAP Reports Processing: FINISH", run);
2353
}
2454
}

0 commit comments

Comments
 (0)