Skip to content

Commit 76a9dac

Browse files
jtnordMarkEWaite
andauthored
Prevent Junit 4 tests from being skipped due to jupiter engine (jenkinsci#5713)
* Prevent Junit 4 tests from being skipped due to jupiter engine @jglick suggested before when this happened we should have a check but I never implemented it. now it has happened again lets add the checj to make sure tests do not get skipped withouth anyone realising because we accidently pull in jupiter-engine. * Update core/src/test/java/jenkins/Junit4TestsRanTest.java Co-authored-by: Mark Waite <mark.earl.waite@gmail.com> * test case needs to be public! * the missing tests where from the test package The tests not being executied due to jenkinsci#5703 where in the test package, so add a test and check there too. Co-authored-by: Mark Waite <mark.earl.waite@gmail.com>
1 parent 98acd19 commit 76a9dac

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

Jenkinsfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ for(j = 0; j < jdks.size(); j++) {
6060
if (runTests) {
6161
junit healthScaleFactor: 20.0, testResults: '*/target/surefire-reports/*.xml,war/junit.xml'
6262
archiveArtifacts allowEmptyArchive: true, artifacts: '**/target/surefire-reports/*.dumpstream'
63+
if (! fileExists('core/target/surefire-reports/TEST-jenkins.Junit4TestsRanTest.xml') ) {
64+
error 'junit 4 tests are no longer being run for the core package'
65+
}
66+
if (! fileExists('test/target/surefire-reports/TEST-jenkins.Junit4TestsRanTest.xml') ) {
67+
error 'junit 4 tests are no longer being run for the test package'
68+
} // cli has been migrated to junit 5
6369
}
6470
if (buildType == 'Linux' && jdk == jdks[0]) {
6571
def changelist = readFile(changelistF)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package jenkins;
2+
3+
import org.junit.Test;
4+
5+
public class Junit4TestsRanTest {
6+
7+
@Test
8+
public void anything() {
9+
// intentionally blank.
10+
// we just want a test that runs with junit 4 so that if tests get skipped due to the introduction of jupiter engine we are alerted
11+
}
12+
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package jenkins;
2+
3+
import org.junit.Test;
4+
5+
public class Junit4TestsRanTest {
6+
7+
@Test
8+
public void anything() {
9+
// intentionally blank.
10+
// we just want a test that runs with junit 4 so that if tests get skipped due to the introduction of jupiter engine we are alerted
11+
}
12+
13+
}

0 commit comments

Comments
 (0)