Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f8af22b

Browse files
committedMay 3, 2018
[JENKINS-37611] Add "@symbol" annotation to xunit and parameters
Add @symbol annotation to publisher, thresholds and test type to make pipeline readable. Add pipeline unit test that works with Jenkins 1.x Update parent pom to latest 3.9
1 parent b84c36d commit f8af22b

29 files changed

+291
-74
lines changed
 

‎pom.xml

+73-35
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.jenkins-ci.plugins</groupId>
66
<artifactId>plugin</artifactId>
7-
<version>2.37</version>
7+
<version>3.9</version>
88
</parent>
99

1010
<artifactId>xunit</artifactId>
@@ -41,12 +41,12 @@
4141

4242
<properties>
4343
<dtkit.frmk.version>2.0.0</dtkit.frmk.version>
44-
<xerces.version>2.9.1</xerces.version>
4544
<saxon.version>9.1.0.8</saxon.version>
4645
<dry.run.version>0.1</dry.run.version>
4746
<xmlunit.version>1.6</xmlunit.version>
4847
<mockito.version>2.17.0</mockito.version>
4948
<jenkins.version>1.651.3</jenkins.version>
49+
<java.level>7</java.level>
5050
</properties>
5151

5252
<repositories>
@@ -63,6 +63,26 @@
6363
</pluginRepository>
6464
</pluginRepositories>
6565

66+
<dependencyManagement>
67+
<dependencies>
68+
<dependency>
69+
<groupId>org.jenkins-ci</groupId>
70+
<artifactId>annotation-indexer</artifactId>
71+
<version>1.9</version>
72+
</dependency>
73+
<dependency>
74+
<groupId>org.jenkins-ci.plugins.workflow</groupId>
75+
<artifactId>workflow-api</artifactId>
76+
<version>2.19</version>
77+
</dependency>
78+
<dependency>
79+
<groupId>org.jenkins-ci.plugins.workflow</groupId>
80+
<artifactId>workflow-step-api</artifactId>
81+
<version>2.12</version>
82+
</dependency>
83+
</dependencies>
84+
</dependencyManagement>
85+
6686
<dependencies>
6787
<dependency>
6888
<groupId>org.jenkins-ci.lib.dtkit</groupId>
@@ -75,7 +95,6 @@
7595
</exclusion>
7696
</exclusions>
7797
</dependency>
78-
7998
<dependency>
8099
<groupId>org.jenkins-ci.lib.dtkit</groupId>
81100
<artifactId>dtkit-metrics-util</artifactId>
@@ -87,7 +106,6 @@
87106
</exclusion>
88107
</exclusions>
89108
</dependency>
90-
91109
<dependency>
92110
<groupId>org.jenkins-ci.lib.dtkit</groupId>
93111
<artifactId>dtkit-metrics-hudson-api</artifactId>
@@ -100,34 +118,17 @@
100118
<version>${dry.run.version}</version>
101119
</dependency>
102120

103-
104-
<dependency>
105-
<groupId>xmlunit</groupId>
106-
<artifactId>xmlunit</artifactId>
107-
<version>${xmlunit.version}</version>
108-
<scope>test</scope>
109-
</dependency>
110-
111-
<dependency>
112-
<groupId>org.mockito</groupId>
113-
<artifactId>mockito-core</artifactId>
114-
<version>${mockito.version}</version>
115-
<scope>test</scope>
116-
</dependency>
117-
118121
<dependency>
119122
<groupId>net.sourceforge.saxon</groupId>
120123
<artifactId>saxon</artifactId>
121124
<version>${saxon.version}</version>
122125
</dependency>
123-
124126
<dependency>
125127
<groupId>net.sourceforge.saxon</groupId>
126128
<artifactId>saxon</artifactId>
127129
<version>${saxon.version}</version>
128130
<classifier>s9api</classifier>
129131
</dependency>
130-
131132
<dependency>
132133
<groupId>net.sourceforge.saxon</groupId>
133134
<artifactId>saxon</artifactId>
@@ -142,12 +143,49 @@
142143
</dependency>
143144

144145
<dependency>
145-
<groupId>org.jenkins-ci.plugins.workflow</groupId>
146-
<artifactId>workflow-aggregator</artifactId>
147-
<version>1.7</version>
146+
<groupId>org.jenkins-ci.plugins</groupId>
147+
<artifactId>structs</artifactId>
148+
<version>1.13</version>
149+
</dependency>
150+
151+
<dependency>
152+
<groupId>xmlunit</groupId>
153+
<artifactId>xmlunit</artifactId>
154+
<version>${xmlunit.version}</version>
155+
<scope>test</scope>
156+
</dependency>
157+
<dependency>
158+
<groupId>org.mockito</groupId>
159+
<artifactId>mockito-core</artifactId>
160+
<version>${mockito.version}</version>
148161
<scope>test</scope>
149162
</dependency>
150163

164+
<!-- dependencies to get pipeline work with Jenkins 1.x -->
165+
<dependency>
166+
<groupId>org.jenkins-ci.plugins.workflow</groupId>
167+
<artifactId>workflow-cps</artifactId>
168+
<version>2.32</version>
169+
<scope>test</scope>
170+
</dependency>
171+
<dependency>
172+
<groupId>org.jenkins-ci.plugins.workflow</groupId>
173+
<artifactId>workflow-job</artifactId>
174+
<version>2.11</version>
175+
<scope>test</scope>
176+
</dependency>
177+
<dependency>
178+
<groupId>org.jenkins-ci.plugins.workflow</groupId>
179+
<artifactId>workflow-durable-task-step</artifactId>
180+
<version>2.13</version>
181+
<scope>test</scope>
182+
</dependency>
183+
<dependency>
184+
<groupId>org.jenkins-ci.plugins.workflow</groupId>
185+
<artifactId>workflow-basic-steps</artifactId>
186+
<version>2.6</version>
187+
<scope>test</scope>
188+
</dependency>
151189
</dependencies>
152190

153191
<scm>
@@ -157,17 +195,17 @@
157195
</scm>
158196

159197
<build>
160-
<pluginManagement>
161-
<plugins>
162-
<plugin>
163-
<groupId>org.codehaus.mojo</groupId>
164-
<artifactId>findbugs-maven-plugin</artifactId>
165-
<configuration>
166-
<excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>
167-
</configuration>
168-
</plugin>
169-
</plugins>
170-
</pluginManagement>
198+
<pluginManagement>
199+
<plugins>
200+
<plugin>
201+
<groupId>org.codehaus.mojo</groupId>
202+
<artifactId>findbugs-maven-plugin</artifactId>
203+
<configuration>
204+
<excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>
205+
</configuration>
206+
</plugin>
207+
</plugins>
208+
</pluginManagement>
171209
<plugins>
172210
<plugin>
173211
<artifactId>maven-dependency-plugin</artifactId>

‎src/main/java/org/jenkinsci/plugins/xunit/XUnitBuilder.java

+2-7
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,10 @@ public class XUnitBuilder extends Builder implements SimpleBuildStep {
6262
private int thresholdMode;
6363
private ExtraConfiguration extraConfiguration;
6464

65-
public XUnitBuilder(@CheckForNull TestType[] tools, @CheckForNull XUnitThreshold[] thresholds) {
66-
this.types = (tools != null ? Arrays.copyOf(tools, tools.length) : new TestType[0]);
67-
this.thresholds = (thresholds != null ? Arrays.copyOf(thresholds, thresholds.length) : new XUnitThreshold[0]);
68-
this.thresholdMode = 1;
69-
}
70-
7165
@DataBoundConstructor
7266
public XUnitBuilder(@CheckForNull TestType[] tools, @CheckForNull XUnitThreshold[] thresholds, int thresholdMode, @CheckForNull String testTimeMargin) {
73-
this(tools, thresholds);
67+
this.types = (tools != null ? Arrays.copyOf(tools, tools.length) : new TestType[0]);
68+
this.thresholds = (thresholds != null ? Arrays.copyOf(thresholds, thresholds.length) : new XUnitThreshold[0]);
7469
this.thresholdMode = thresholdMode;
7570
long longTestTimeMargin = XUnitDefaultValues.TEST_REPORT_TIME_MARGING;
7671
if (testTimeMargin != null && testTimeMargin.trim().length() != 0) {

‎src/main/java/org/jenkinsci/plugins/xunit/XUnitPublisher.java

+6-8
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
import javax.annotation.CheckForNull;
3232

33+
import org.jenkinsci.Symbol;
3334
import org.jenkinsci.lib.dryrun.DryRun;
3435
import org.jenkinsci.lib.dtkit.descriptor.TestTypeDescriptor;
3536
import org.jenkinsci.lib.dtkit.type.TestType;
@@ -39,6 +40,8 @@
3940
import org.jenkinsci.plugins.xunit.threshold.XUnitThresholdDescriptor;
4041
import org.kohsuke.stapler.DataBoundConstructor;
4142

43+
import com.thoughtworks.xstream.annotations.XStreamAlias;
44+
4245
import hudson.DescriptorExtensionList;
4346
import hudson.Extension;
4447
import hudson.FilePath;
@@ -70,15 +73,10 @@ public class XUnitPublisher extends Recorder implements DryRun, Serializable, Si
7073
private int thresholdMode;
7174
private ExtraConfiguration extraConfiguration;
7275

73-
public XUnitPublisher(@CheckForNull TestType[] tools, @CheckForNull XUnitThreshold[] thresholds) {
74-
this.types = (tools != null ? Arrays.copyOf(tools, tools.length) : new TestType[0]);
75-
this.thresholds = (thresholds != null ? Arrays.copyOf(thresholds, thresholds.length) : new XUnitThreshold[0]);
76-
this.thresholdMode = 1;
77-
}
78-
7976
@DataBoundConstructor
8077
public XUnitPublisher(@CheckForNull TestType[] tools, @CheckForNull XUnitThreshold[] thresholds, int thresholdMode, @CheckForNull String testTimeMargin) {
81-
this(tools, thresholds);
78+
this.types = (tools != null ? Arrays.copyOf(tools, tools.length) : new TestType[0]);
79+
this.thresholds = (thresholds != null ? Arrays.copyOf(thresholds, thresholds.length) : new XUnitThreshold[0]);
8280
this.thresholdMode = thresholdMode;
8381
long longTestTimeMargin = XUnitDefaultValues.TEST_REPORT_TIME_MARGING;
8482
if (testTimeMargin != null && testTimeMargin.trim().length() != 0) {
@@ -151,12 +149,12 @@ public boolean performDryRun(AbstractBuild<?, ?> build, Launcher launcher, Build
151149
return true;
152150
}
153151

154-
155152
@Override
156153
public BuildStepMonitor getRequiredMonitorService() {
157154
return BuildStepMonitor.NONE;
158155
}
159156

157+
@Symbol("xunit")
160158
@Extension
161159
public static final class XUnitDescriptorPublisher extends BuildStepDescriptor<Publisher> {
162160

‎src/main/java/org/jenkinsci/plugins/xunit/threshold/FailedThresholdDescriptor.java

+3
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,14 @@
2424

2525
package org.jenkinsci.plugins.xunit.threshold;
2626

27+
import org.jenkinsci.Symbol;
28+
2729
import hudson.Extension;
2830

2931
/**
3032
* @author Gregory Boissinot
3133
*/
34+
@Symbol("failed")
3235
@Extension
3336
public class FailedThresholdDescriptor extends XUnitThresholdDescriptor<FailedThreshold> {
3437

‎src/main/java/org/jenkinsci/plugins/xunit/threshold/SkippedThresholdDescriptor.java

+3
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,14 @@
2424

2525
package org.jenkinsci.plugins.xunit.threshold;
2626

27+
import org.jenkinsci.Symbol;
28+
2729
import hudson.Extension;
2830

2931
/**
3032
* @author Gregory Boissinot
3133
*/
34+
@Symbol("skipped")
3235
@Extension
3336
public class SkippedThresholdDescriptor extends XUnitThresholdDescriptor<SkippedThreshold> {
3437

‎src/main/java/org/jenkinsci/plugins/xunit/types/AUnitJunitHudsonTestType.java

+11-1
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,28 @@
2424

2525
package org.jenkinsci.plugins.xunit.types;
2626

27-
import hudson.Extension;
27+
import org.jenkinsci.Symbol;
2828
import org.jenkinsci.lib.dtkit.descriptor.TestTypeDescriptor;
2929
import org.jenkinsci.lib.dtkit.type.TestType;
3030
import org.kohsuke.stapler.DataBoundConstructor;
3131

32+
import hudson.Extension;
33+
34+
/**
35+
* <a href=
36+
* "http://docs.adacore.com/live/wave/aunit/html/aunit_cb/aunit_cb.html">AUnit</a>
37+
* is a unit testing framework of the xUnit family for the Ada language,
38+
* originally developed by Ed Falis and maintained by AdaCore, distributed
39+
* together with GNAT.
40+
*/
3241
public class AUnitJunitHudsonTestType extends TestType {
3342

3443
@DataBoundConstructor
3544
public AUnitJunitHudsonTestType(String pattern, boolean skipNoTestFiles, boolean failIfNotNew, boolean deleteOutputFiles, boolean stopProcessingIfError) {
3645
super(pattern, skipNoTestFiles, failIfNotNew, deleteOutputFiles, stopProcessingIfError);
3746
}
3847

48+
@Symbol("AUnit")
3949
@Extension
4050
public static class DescriptorImpl extends TestTypeDescriptor<AUnitJunitHudsonTestType> {
4151

‎src/main/java/org/jenkinsci/plugins/xunit/types/BoostTestJunitHudsonTestType.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,26 @@
2424

2525
package org.jenkinsci.plugins.xunit.types;
2626

27-
import hudson.Extension;
27+
import org.jenkinsci.Symbol;
2828
import org.jenkinsci.lib.dtkit.descriptor.TestTypeDescriptor;
2929
import org.jenkinsci.lib.dtkit.type.TestType;
3030
import org.kohsuke.stapler.DataBoundConstructor;
3131

32+
import hudson.Extension;
33+
34+
/**
35+
* <a href="http://www.boost.org/doc/libs/release/libs/test">Boost.Test</a> is a
36+
* C++03 and C++11/14 unit testing library, available on a wide range of
37+
* platforms and compilers. The library is part of Boost.
38+
*/
3239
public class BoostTestJunitHudsonTestType extends TestType {
3340

3441
@DataBoundConstructor
3542
public BoostTestJunitHudsonTestType(String pattern, boolean skipNoTestFiles, boolean failIfNotNew, boolean deleteOutputFiles, boolean stopProcessingIfError) {
3643
super(pattern, skipNoTestFiles, failIfNotNew, deleteOutputFiles, stopProcessingIfError);
3744
}
3845

46+
@Symbol("BoostTest")
3947
@Extension
4048
public static class DescriptorImpl extends TestTypeDescriptor<BoostTestJunitHudsonTestType> {
4149

‎src/main/java/org/jenkinsci/plugins/xunit/types/CTestType.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,20 @@
2424

2525
package org.jenkinsci.plugins.xunit.types;
2626

27-
import hudson.Extension;
27+
import org.jenkinsci.Symbol;
2828
import org.jenkinsci.lib.dtkit.descriptor.TestTypeDescriptor;
2929
import org.jenkinsci.lib.dtkit.type.TestType;
3030
import org.kohsuke.stapler.DataBoundConstructor;
3131

32+
import hudson.Extension;
33+
3234
/**
35+
* <a href="https://cmake.org/Wiki/CMake/Testing_With_CTest">CTest</a> is a
36+
* testing tool distributed as a part of CMake. It can be used to automate
37+
* updating (using CVS for example), configuring, building, testing, performing
38+
* memory checking, performing coverage, and submitting results to a CDash or
39+
* Dart dashboard system.
40+
*
3341
* @author Gregory Boissinot
3442
*/
3543
public class CTestType extends TestType {
@@ -39,6 +47,7 @@ public CTestType(String pattern, boolean skipNoTestFiles, boolean failIfNotNew,
3947
super(pattern, skipNoTestFiles, failIfNotNew, deleteOutputFiles, stopProcessingIfError);
4048
}
4149

50+
@Symbol("CTest")
4251
@Extension
4352
public static class CTestTypeDescriptor extends TestTypeDescriptor<CTestType> {
4453

‎src/main/java/org/jenkinsci/plugins/xunit/types/CUnitJunitHudsonTestType.java

+11-1
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,28 @@
2424

2525
package org.jenkinsci.plugins.xunit.types;
2626

27-
import hudson.Extension;
27+
import org.jenkinsci.Symbol;
2828
import org.jenkinsci.lib.dtkit.descriptor.TestTypeDescriptor;
2929
import org.jenkinsci.lib.dtkit.type.TestType;
3030
import org.kohsuke.stapler.DataBoundConstructor;
3131

32+
import hudson.Extension;
33+
34+
/**
35+
* <a href="http://cunit.sourceforge.net">CUnit</a> is a lightweight system for
36+
* writing, administering, and running unit tests in C.
37+
* <p>
38+
* It provides C programmers a basic testing functionality with a flexible
39+
* variety of user interfaces.
40+
*/
3241
public class CUnitJunitHudsonTestType extends TestType {
3342

3443
@DataBoundConstructor
3544
public CUnitJunitHudsonTestType(String pattern, boolean skipNoTestFiles, boolean failIfNotNew, boolean deleteOutputFiles, boolean stopProcessingIfError) {
3645
super(pattern, skipNoTestFiles, failIfNotNew, deleteOutputFiles, stopProcessingIfError);
3746
}
3847

48+
@Symbol("CUnit")
3949
@Extension
4050
public static class DescriptorImpl extends TestTypeDescriptor<CUnitJunitHudsonTestType> {
4151

‎src/main/java/org/jenkinsci/plugins/xunit/types/CheckType.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@
2424

2525
package org.jenkinsci.plugins.xunit.types;
2626

27-
import hudson.Extension;
27+
import org.jenkinsci.Symbol;
2828
import org.jenkinsci.lib.dtkit.descriptor.TestTypeDescriptor;
2929
import org.jenkinsci.lib.dtkit.type.TestType;
3030
import org.kohsuke.stapler.DataBoundConstructor;
3131

32+
import hudson.Extension;
33+
3234
/**
3335
* @author Gregory Boissinot
3436
*/
@@ -39,6 +41,7 @@ public CheckType(String pattern, boolean skipNoTestFiles, boolean failIfNotNew,
3941
super(pattern, skipNoTestFiles, failIfNotNew, deleteOutputFiles, stopProcessingIfError);
4042
}
4143

44+
@Symbol("Check")
4245
@Extension
4346
public static class CheckTypeDescriptor extends TestTypeDescriptor<CheckType> {
4447

‎src/main/java/org/jenkinsci/plugins/xunit/types/CppTestJunitHudsonTestType.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,26 @@
2424

2525
package org.jenkinsci.plugins.xunit.types;
2626

27-
import hudson.Extension;
27+
import org.jenkinsci.Symbol;
2828
import org.jenkinsci.lib.dtkit.descriptor.TestTypeDescriptor;
2929
import org.jenkinsci.lib.dtkit.type.TestType;
3030
import org.kohsuke.stapler.DataBoundConstructor;
3131

32+
import hudson.Extension;
33+
34+
/**
35+
* <a href="http://cpptest.sourceforge.net">CppTest</a> is a portable and
36+
* powerful, yet simple, unit testing framework for handling automated tests in
37+
* C++. The focus lies on usability and extendability.
38+
*/
3239
public class CppTestJunitHudsonTestType extends TestType {
3340

3441
@DataBoundConstructor
3542
public CppTestJunitHudsonTestType(String pattern, boolean skipNoTestFiles, boolean failIfNotNew, boolean deleteOutputFiles, boolean stopProcessingIfError) {
3643
super(pattern, skipNoTestFiles, failIfNotNew, deleteOutputFiles, stopProcessingIfError);
3744
}
3845

46+
@Symbol("CppTest")
3947
@Extension
4048
public static class DescriptorImpl extends TestTypeDescriptor<CppTestJunitHudsonTestType> {
4149

‎src/main/java/org/jenkinsci/plugins/xunit/types/CppUnitJunitHudsonTestType.java

+13-1
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,30 @@
2424

2525
package org.jenkinsci.plugins.xunit.types;
2626

27-
import hudson.Extension;
27+
import org.jenkinsci.Symbol;
2828
import org.jenkinsci.lib.dtkit.descriptor.TestTypeDescriptor;
2929
import org.jenkinsci.lib.dtkit.type.TestType;
3030
import org.kohsuke.stapler.DataBoundConstructor;
3131

32+
import hudson.Extension;
33+
34+
/**
35+
* <a href="http://cppunit.sourceforge.net/doc/cvs/index.html">CppUnit</a> is a
36+
* unit testing framework module for the C++ programming language.
37+
* <p>
38+
* The first port of JUnit to C++ was done by Michael Feathers. His versions can
39+
* be found on the XProgramming software page. They are os-specific, so Jerome
40+
* Lacoste provided a port to Unix/Solaris. His version can be found on the same
41+
* page. The CppUnit project has combined and built on this work.
42+
*/
3243
public class CppUnitJunitHudsonTestType extends TestType {
3344

3445
@DataBoundConstructor
3546
public CppUnitJunitHudsonTestType(String pattern, boolean skipNoTestFiles, boolean failIfNotNew, boolean deleteOutputFiles, boolean stopProcessingIfError) {
3647
super(pattern, skipNoTestFiles, failIfNotNew, deleteOutputFiles, stopProcessingIfError);
3748
}
3849

50+
@Symbol("CppUnit")
3951
@Extension
4052
public static class DescriptorImpl extends TestTypeDescriptor<CppUnitJunitHudsonTestType> {
4153

‎src/main/java/org/jenkinsci/plugins/xunit/types/CustomType.java

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
package org.jenkinsci.plugins.xunit.types;
2626

27+
import org.jenkinsci.Symbol;
2728
import org.jenkinsci.lib.dtkit.descriptor.TestTypeDescriptor;
2829
import org.jenkinsci.lib.dtkit.type.TestType;
2930
import org.kohsuke.stapler.DataBoundConstructor;
@@ -47,6 +48,7 @@ public String getCustomXSL() {
4748
return customXSL;
4849
}
4950

51+
@Symbol("Custom")
5052
@Extension
5153
public static class CustomInputMetricDescriptor extends TestTypeDescriptor<CustomType> {
5254

‎src/main/java/org/jenkinsci/plugins/xunit/types/EmbUnitType.java

+11-1
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,21 @@
2424

2525
package org.jenkinsci.plugins.xunit.types;
2626

27-
import hudson.Extension;
27+
import org.jenkinsci.Symbol;
2828
import org.jenkinsci.lib.dtkit.descriptor.TestTypeDescriptor;
2929
import org.jenkinsci.lib.dtkit.type.TestType;
3030
import org.kohsuke.stapler.DataBoundConstructor;
3131

32+
import hudson.Extension;
33+
3234
/**
35+
* <a href="http://embunit.sourceforge.net/embunit">Embedded Unit</a> is unit
36+
* testing framework for Embedded C System.
37+
* <p>
38+
* It's design was copied from JUnit and CUnit and more, and then adapted
39+
* somewhat for Embedded C System. Embedded Unit does not require std C libs.
40+
* All objects are allocated to const area.
41+
*
3342
* @author Gregory Boissinot
3443
*/
3544
public class EmbUnitType extends TestType {
@@ -39,6 +48,7 @@ public EmbUnitType(String pattern, boolean skipNoTestFiles, boolean failIfNotNew
3948
super(pattern, skipNoTestFiles, failIfNotNew, deleteOutputFiles, stopProcessingIfError);
4049
}
4150

51+
@Symbol("embUnit")
4252
@Extension
4353
public static class EmbUnitTypeDescriptor extends TestTypeDescriptor<EmbUnitType> {
4454

‎src/main/java/org/jenkinsci/plugins/xunit/types/FPCUnitJunitHudsonTestType.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,27 @@
2424

2525
package org.jenkinsci.plugins.xunit.types;
2626

27-
import hudson.Extension;
27+
import org.jenkinsci.Symbol;
2828
import org.jenkinsci.lib.dtkit.descriptor.TestTypeDescriptor;
2929
import org.jenkinsci.lib.dtkit.type.TestType;
3030
import org.kohsuke.stapler.DataBoundConstructor;
3131

32+
import hudson.Extension;
33+
34+
/**
35+
* <a href="http://wiki.freepascal.org/fpcunit">FPCUni</a> is a unit testing
36+
* framework a la DUnit/JUnit/SUnit. This allows you to quickly write a set of
37+
* test for a (logical) unit of code (not necessarily the same as a Pascal unit,
38+
* though often it is).
39+
*/
3240
public class FPCUnitJunitHudsonTestType extends TestType {
3341

3442
@DataBoundConstructor
3543
public FPCUnitJunitHudsonTestType(String pattern, boolean skipNoTestFiles, boolean failIfNotNew, boolean deleteOutputFiles, boolean stopProcessingIfError) {
3644
super(pattern, skipNoTestFiles, failIfNotNew, deleteOutputFiles, stopProcessingIfError);
3745
}
3846

47+
@Symbol("FPCUnit")
3948
@Extension
4049
public static class DescriptorImpl extends TestTypeDescriptor<FPCUnitJunitHudsonTestType> {
4150

‎src/main/java/org/jenkinsci/plugins/xunit/types/GTesterJunitHudsonTestType.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,26 @@
2424

2525
package org.jenkinsci.plugins.xunit.types;
2626

27-
import hudson.Extension;
27+
import org.jenkinsci.Symbol;
2828
import org.jenkinsci.lib.dtkit.descriptor.TestTypeDescriptor;
2929
import org.jenkinsci.lib.dtkit.type.TestType;
3030
import org.kohsuke.stapler.DataBoundConstructor;
3131

32+
import hudson.Extension;
33+
34+
/**
35+
* <a href="https://developer.gnome.org/glib/stable/gtester.html">gtester</a> is
36+
* a utility to run unit tests that have been written using the GLib test
37+
* framework.
38+
*/
3239
public class GTesterJunitHudsonTestType extends TestType {
3340

3441
@DataBoundConstructor
3542
public GTesterJunitHudsonTestType(String pattern, boolean skipNoTestFiles, boolean failIfNotNew, boolean deleteOutputFiles, boolean stopProcessingIfError) {
3643
super(pattern, skipNoTestFiles, failIfNotNew, deleteOutputFiles, stopProcessingIfError);
3744
}
3845

46+
@Symbol("gtester")
3947
@Extension
4048
public static class DescriptorImpl extends TestTypeDescriptor<GTesterJunitHudsonTestType> {
4149

‎src/main/java/org/jenkinsci/plugins/xunit/types/GoogleTestType.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,17 @@
2424

2525
package org.jenkinsci.plugins.xunit.types;
2626

27-
import hudson.Extension;
27+
import org.jenkinsci.Symbol;
2828
import org.jenkinsci.lib.dtkit.descriptor.TestTypeDescriptor;
2929
import org.jenkinsci.lib.dtkit.type.TestType;
3030
import org.kohsuke.stapler.DataBoundConstructor;
3131

32+
import hudson.Extension;
33+
3234
/**
35+
* <a href="https://github.com/google/googletest">Google Test</a>, Google's C++
36+
* test framework!
37+
*
3338
* @author David Hallas
3439
*/
3540
public class GoogleTestType extends TestType {
@@ -39,6 +44,7 @@ public GoogleTestType(String pattern, boolean skipNoTestFiles, boolean failIfNot
3944
super(pattern, skipNoTestFiles, failIfNotNew, deleteOutputFiles, stopProcessingIfError);
4045
}
4146

47+
@Symbol("GoogleTest")
4248
@Extension
4349
public static class GoogleTestTypeDescriptor extends TestTypeDescriptor<GoogleTestType> {
4450

‎src/main/java/org/jenkinsci/plugins/xunit/types/JUnitType.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,18 @@
2424

2525
package org.jenkinsci.plugins.xunit.types;
2626

27-
import hudson.Extension;
27+
import org.jenkinsci.Symbol;
2828
import org.jenkinsci.lib.dtkit.descriptor.TestTypeDescriptor;
2929
import org.jenkinsci.lib.dtkit.type.TestType;
3030
import org.kohsuke.stapler.DataBoundConstructor;
3131

32+
import hudson.Extension;
33+
3234
/**
35+
* <a href="https://junit.org">JUnit</a> is a simple framework to write
36+
* repeatable tests. It is an instance of the xUnit architecture for unit
37+
* testing frameworks.
38+
*
3339
* @author Gregory Boissinot
3440
*/
3541
public class JUnitType extends TestType {
@@ -39,6 +45,7 @@ public JUnitType(String pattern, boolean skipNoTestFiles, boolean failIfNotNew,
3945
super(pattern, skipNoTestFiles, failIfNotNew, deleteOutputFiles, stopProcessingIfError);
4046
}
4147

48+
@Symbol("JUnit")
4249
@Extension
4350
public static class JUnitTypeDescriptor extends TestTypeDescriptor<JUnitType> {
4451

‎src/main/java/org/jenkinsci/plugins/xunit/types/MSTestJunitHudsonTestType.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,25 @@
2424

2525
package org.jenkinsci.plugins.xunit.types;
2626

27-
import hudson.Extension;
27+
import org.jenkinsci.Symbol;
2828
import org.jenkinsci.lib.dtkit.descriptor.TestTypeDescriptor;
2929
import org.jenkinsci.lib.dtkit.type.TestType;
3030
import org.kohsuke.stapler.DataBoundConstructor;
3131

32+
import hudson.Extension;
33+
34+
/**
35+
* <a href= "https://github.com/Microsoft/testfx">Microsoft Test Framework and
36+
* Adapter</a> it's the testing framework embedded in .NET Core.
37+
*/
3238
public class MSTestJunitHudsonTestType extends TestType {
3339

3440
@DataBoundConstructor
3541
public MSTestJunitHudsonTestType(String pattern, boolean skipNoTestFiles, boolean failIfNotNew, boolean deleteOutputFiles, boolean stopProcessingIfError) {
3642
super(pattern, skipNoTestFiles, failIfNotNew, deleteOutputFiles, stopProcessingIfError);
3743
}
3844

45+
@Symbol("MSTest")
3946
@Extension
4047
public static class DescriptorImpl extends TestTypeDescriptor<MSTestJunitHudsonTestType> {
4148

‎src/main/java/org/jenkinsci/plugins/xunit/types/MbUnitType.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,18 @@
2424

2525
package org.jenkinsci.plugins.xunit.types;
2626

27-
import hudson.Extension;
27+
import org.jenkinsci.Symbol;
2828
import org.jenkinsci.lib.dtkit.descriptor.TestTypeDescriptor;
2929
import org.jenkinsci.lib.dtkit.type.TestType;
3030
import org.kohsuke.stapler.DataBoundConstructor;
3131

32+
import hudson.Extension;
33+
3234
/**
35+
* <a href="https://github.com/Gallio/mbunit-v2">MbUnit</a> is an extensible
36+
* unit testing framework for the .NET Framework that takes in and goes beyond
37+
* xUnit pattern testing. MbUnit is part of the Gallio bundle.
38+
*
3339
* @author Gregory Boissinot
3440
*/
3541
public class MbUnitType extends TestType {
@@ -39,6 +45,7 @@ public MbUnitType(String pattern, boolean skipNoTestFiles, boolean failIfNotNew,
3945
super(pattern, skipNoTestFiles, failIfNotNew, deleteOutputFiles, stopProcessingIfError);
4046
}
4147

48+
@Symbol("MbUnit")
4249
@Extension
4350
public static class MbUnitTypeDescriptor extends TestTypeDescriptor<MbUnitType> {
4451

‎src/main/java/org/jenkinsci/plugins/xunit/types/NUnit3TestType.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,21 @@
2424

2525
package org.jenkinsci.plugins.xunit.types;
2626

27-
import hudson.Extension;
27+
import org.jenkinsci.Symbol;
2828
import org.jenkinsci.lib.dtkit.descriptor.TestTypeDescriptor;
2929
import org.jenkinsci.lib.dtkit.type.TestType;
3030
import org.kohsuke.stapler.DataBoundConstructor;
3131

32+
import hudson.Extension;
33+
3234
public class NUnit3TestType extends TestType {
3335

3436
@DataBoundConstructor
3537
public NUnit3TestType(String pattern, boolean skipNoTestFiles, boolean failIfNotNew, boolean deleteOutputFiles, boolean stopProcessingIfError) {
3638
super(pattern, skipNoTestFiles, failIfNotNew, deleteOutputFiles, stopProcessingIfError);
3739
}
3840

41+
@Symbol("NUnit3")
3942
@Extension
4043
public static class DescriptorImpl extends TestTypeDescriptor<NUnit3TestType> {
4144

‎src/main/java/org/jenkinsci/plugins/xunit/types/NUnitJunitHudsonTestType.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,25 @@
2424

2525
package org.jenkinsci.plugins.xunit.types;
2626

27-
import hudson.Extension;
27+
import org.jenkinsci.Symbol;
2828
import org.jenkinsci.lib.dtkit.descriptor.TestTypeDescriptor;
2929
import org.jenkinsci.lib.dtkit.type.TestType;
3030
import org.kohsuke.stapler.DataBoundConstructor;
3131

32+
import hudson.Extension;
33+
34+
/**
35+
* <a href="http://nunit.org">NUnit</a> is a unit-testing framework for all .Net
36+
* languages.
37+
*/
3238
public class NUnitJunitHudsonTestType extends TestType {
3339

3440
@DataBoundConstructor
3541
public NUnitJunitHudsonTestType(String pattern, boolean skipNoTestFiles, boolean failIfNotNew, boolean deleteOutputFiles, boolean stopProcessingIfError) {
3642
super(pattern, skipNoTestFiles, failIfNotNew, deleteOutputFiles, stopProcessingIfError);
3743
}
3844

45+
@Symbol("NUnit2")
3946
@Extension
4047
public static class DescriptorImpl extends TestTypeDescriptor<NUnitJunitHudsonTestType> {
4148

‎src/main/java/org/jenkinsci/plugins/xunit/types/PHPUnitJunitHudsonTestType.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,26 @@
2424

2525
package org.jenkinsci.plugins.xunit.types;
2626

27-
import hudson.Extension;
27+
import org.jenkinsci.Symbol;
2828
import org.jenkinsci.lib.dtkit.descriptor.TestTypeDescriptor;
2929
import org.jenkinsci.lib.dtkit.type.TestType;
3030
import org.kohsuke.stapler.DataBoundConstructor;
3131

32+
import hudson.Extension;
33+
34+
/**
35+
* <a href="https://phpunit.de">PHPUnit</a> is a programmer-oriented testing
36+
* framework for PHP. It is an instance of the xUnit architecture for unit
37+
* testing frameworks.
38+
*/
3239
public class PHPUnitJunitHudsonTestType extends TestType {
3340

3441
@DataBoundConstructor
3542
public PHPUnitJunitHudsonTestType(String pattern, boolean skipNoTestFiles, boolean failIfNotNew, boolean deleteOutputFiles, boolean stopProcessingIfError) {
3643
super(pattern, skipNoTestFiles, failIfNotNew, deleteOutputFiles, stopProcessingIfError);
3744
}
3845

46+
@Symbol("PHPUnit")
3947
@Extension
4048
public static class DescriptorImpl extends TestTypeDescriptor<PHPUnitJunitHudsonTestType> {
4149

‎src/main/java/org/jenkinsci/plugins/xunit/types/QTestLibInputMetric.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public InputType getToolType() {
4141

4242
@Override
4343
public String getToolVersion() {
44-
return "Version N/A";
44+
return "Version 5.x";
4545
}
4646

4747
@Override

‎src/main/java/org/jenkinsci/plugins/xunit/types/QTestLibType.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,20 @@
2424

2525
package org.jenkinsci.plugins.xunit.types;
2626

27-
import hudson.Extension;
27+
import org.jenkinsci.Symbol;
2828
import org.jenkinsci.lib.dtkit.descriptor.TestTypeDescriptor;
2929
import org.jenkinsci.lib.dtkit.type.TestType;
3030
import org.kohsuke.stapler.DataBoundConstructor;
3131

32+
import hudson.Extension;
33+
3234
/**
35+
* <a href="http://doc.qt.io/qt-5/qtest-overview.html">Qt Test</a> is a
36+
* framework for unit testing Qt based applications and libraries.
37+
* <p>
38+
* Qt Test provides all the functionality commonly found in unit testing
39+
* frameworks as well as extensions for testing graphical user interfaces.
40+
*
3341
* @author Gregory Boissinot
3442
*/
3543
public class QTestLibType extends TestType {
@@ -39,6 +47,7 @@ public QTestLibType(String pattern, boolean skipNoTestFiles, boolean failIfNotNe
3947
super(pattern, skipNoTestFiles, failIfNotNew, deleteOutputFiles, stopProcessingIfError);
4048
}
4149

50+
@Symbol("QtTest")
4251
@Extension
4352
public static class QTestLibTypeDescriptor extends TestTypeDescriptor<QTestLibType> {
4453

‎src/main/java/org/jenkinsci/plugins/xunit/types/UnitTestJunitHudsonTestType.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,21 @@
2424

2525
package org.jenkinsci.plugins.xunit.types;
2626

27-
import hudson.Extension;
27+
import org.jenkinsci.Symbol;
2828
import org.jenkinsci.lib.dtkit.descriptor.TestTypeDescriptor;
2929
import org.jenkinsci.lib.dtkit.type.TestType;
3030
import org.kohsuke.stapler.DataBoundConstructor;
3131

32+
import hudson.Extension;
33+
3234
public class UnitTestJunitHudsonTestType extends TestType {
3335

3436
@DataBoundConstructor
3537
public UnitTestJunitHudsonTestType(String pattern, boolean skipNoTestFiles, boolean failIfNotNew, boolean deleteOutputFiles, boolean stopProcessingIfError) {
3638
super(pattern, skipNoTestFiles, failIfNotNew, deleteOutputFiles, stopProcessingIfError);
3739
}
3840

41+
@Symbol("UnitTest")
3942
@Extension
4043
public static class DescriptorImpl extends TestTypeDescriptor<UnitTestJunitHudsonTestType> {
4144

‎src/main/java/org/jenkinsci/plugins/xunit/types/ValgrindJunitHudsonTestType.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,27 @@
2424

2525
package org.jenkinsci.plugins.xunit.types;
2626

27-
import hudson.Extension;
27+
import org.jenkinsci.Symbol;
2828
import org.jenkinsci.lib.dtkit.descriptor.TestTypeDescriptor;
2929
import org.jenkinsci.lib.dtkit.type.TestType;
3030
import org.kohsuke.stapler.DataBoundConstructor;
3131

32+
import hudson.Extension;
33+
34+
/**
35+
* <a href="http://valgrind.org">Valgrind</a> is an instrumentation framework for
36+
* building dynamic analysis tools. There are Valgrind tools that can
37+
* automatically detect many memory management and threading bugs, and profile
38+
* your programs in detail.
39+
*/
3240
public class ValgrindJunitHudsonTestType extends TestType {
3341

3442
@DataBoundConstructor
3543
public ValgrindJunitHudsonTestType(String pattern, boolean skipNoTestFiles, boolean failIfNotNew, boolean deleteOutputFiles, boolean stopProcessingIfError) {
3644
super(pattern, skipNoTestFiles, failIfNotNew, deleteOutputFiles, stopProcessingIfError);
3745
}
3846

47+
@Symbol("Valgrind")
3948
@Extension
4049
public static class DescriptorImpl extends TestTypeDescriptor<ValgrindJunitHudsonTestType> {
4150

‎src/main/java/org/jenkinsci/plugins/xunit/types/XUnitDotNetTestType.java

+11-1
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,28 @@
2424

2525
package org.jenkinsci.plugins.xunit.types;
2626

27-
import hudson.Extension;
27+
import org.jenkinsci.Symbol;
2828
import org.jenkinsci.lib.dtkit.descriptor.TestTypeDescriptor;
2929
import org.jenkinsci.lib.dtkit.type.TestType;
3030
import org.kohsuke.stapler.DataBoundConstructor;
3131

32+
import hudson.Extension;
33+
34+
/**
35+
* <a href="https://xunit.github.io">xUnit.net</a> is a free, open source,
36+
* community-focused unit testing tool for the .NET Framework.
37+
* <p>
38+
* Written by the original inventor of NUnit v2, xUnit.net is the latest
39+
* technology for unit testing C#, F#, VB.NET and other .NET languages.
40+
*/
3241
public class XUnitDotNetTestType extends TestType {
3342

3443
@DataBoundConstructor
3544
public XUnitDotNetTestType(String pattern, boolean skipNoTestFiles, boolean failIfNotNew, boolean deleteOutputFiles, boolean stopProcessingIfError) {
3645
super(pattern, skipNoTestFiles, failIfNotNew, deleteOutputFiles, stopProcessingIfError);
3746
}
3847

48+
@Symbol("xUnitDotNet")
3949
@Extension
4050
public static class DescriptorImpl extends TestTypeDescriptor<XUnitDotNetTestType> {
4151

‎src/test/java/org/jenkinsci/plugins/xunit/XUnitWorkflowTest.java

+17-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public void xunitBuilderWorkflowStepTest() throws Exception {
5353
job.setDefinition(new CpsFlowDefinition(""
5454
+ "node {\n"
5555
+ " step([$class: 'XUnitBuilder', testTimeMargin: '3000', thresholdMode: 1, thresholds: [[$class: 'FailedThreshold', failureNewThreshold: '', failureThreshold: '', unstableNewThreshold: '', unstableThreshold: '1'], [$class: 'SkippedThreshold', failureNewThreshold: '', failureThreshold: '', unstableNewThreshold: '', unstableThreshold: '']], tools: [[$class: 'GoogleTestType', deleteOutputFiles: false, failIfNotNew: false, pattern: 'input.xml', skipNoTestFiles: false, stopProcessingIfError: true]]])\n"
56-
+ "}"));
56+
+ "}", true));
5757

5858
jenkinsRule.assertBuildStatus(Result.UNSTABLE, job.scheduleBuild2(0).get());
5959
}
@@ -76,8 +76,23 @@ public void xunitPublisherWorkflowStepTest() throws Exception {
7676
job.setDefinition(new CpsFlowDefinition(""
7777
+ "node {\n"
7878
+ " step([$class: 'XUnitPublisher', testTimeMargin: '3000', thresholdMode: 1, thresholds: [[$class: 'FailedThreshold', failureNewThreshold: '', failureThreshold: '', unstableNewThreshold: '', unstableThreshold: '1'], [$class: 'SkippedThreshold', failureNewThreshold: '', failureThreshold: '', unstableNewThreshold: '', unstableThreshold: '']], tools: [[$class: 'GoogleTestType', deleteOutputFiles: false, failIfNotNew: false, pattern: 'input.xml', skipNoTestFiles: false, stopProcessingIfError: true]]])\n"
79-
+ "}"));
79+
+ "}", true));
80+
81+
jenkinsRule.assertBuildStatus(Result.UNSTABLE, job.scheduleBuild2(0).get());
82+
}
8083

84+
@Test
85+
public void xunit() throws Exception {
86+
WorkflowJob job = getBaseJob("readablePublisherPipeline");
87+
job.setDefinition(new CpsFlowDefinition(""
88+
+ "node {\n"
89+
+ " xunit(testTimeMargin: '3000',"
90+
+ " thresholdMode: 1,"
91+
+ " thresholds: [ failed(failureNewThreshold: '', failureThreshold: '', unstableNewThreshold: '', unstableThreshold: '1') ],"
92+
+ " tools: [ GoogleTest(deleteOutputFiles: false, failIfNotNew: false, pattern: 'input.xml', skipNoTestFiles: false, stopProcessingIfError: true) ]"
93+
+ " )\n"
94+
+ "}", true));
95+
8196
jenkinsRule.assertBuildStatus(Result.UNSTABLE, job.scheduleBuild2(0).get());
8297
}
8398
}

0 commit comments

Comments
 (0)
Please sign in to comment.