JenkinsPipelineUnit Versions Save

Framework for unit testing Jenkins pipelines

v1.20

2 weeks ago

⚠️ Breaking changes

  • Add match-all addShMock invocation (#657) @rmartine-ias

This change removes the null argument to addShMock/addBatMock for registering a default matcher. The new API takes only a Closure, meaning that you can simply remove the null argument. Adapting your code should look something like this:

-helper.addShMock(null) { println(“No call matched”) }
+helper.addShMock { println(“No call matched”) }

✍ Other changes

  • Add calls to super.setUp() in README examples (#646) @nre-ableton
  • Update README.md to discuss setUp (#620) @ryeleo
  • Update release documentation (#614) @nre-ableton

📦 Dependency updates

31 changes
  • Bump com.cloudbees:groovy-cps from 3867.v535458ce43fd to 3894.3896.vca_2c931e7935 (#658) @dependabot
  • Bump commons-io:commons-io from 2.16.0 to 2.16.1 (#656) @dependabot
  • Bump commons-io:commons-io from 2.15.1 to 2.16.0 (#655) @dependabot
  • Bump com.cloudbees:groovy-cps from 3832.vc43e04d6d68c to 3867.v535458ce43fd (#654) @dependabot
  • Bump com.jfrog.artifactory from 5.1.14 to 5.2.0 (#652) @dependabot
  • Bump org.assertj:assertj-core from 3.25.2 to 3.25.3 (#651) @dependabot
  • Bump org.assertj:assertj-core from 3.25.1 to 3.25.2 (#650) @dependabot
  • Bump io.jenkins.plugins:pipeline-groovy-lib from 687.v62591d623759 to 700.v0e341fa_57d53 (#649) @dependabot
  • Bump com.jfrog.artifactory from 5.1.13 to 5.1.14 (#648) @dependabot
  • Bump com.cloudbees:groovy-cps from 3773.v505e0052522c to 3832.vc43e04d6d68c (#645) @dependabot
  • Bump org.assertj:assertj-core from 3.25.0 to 3.25.1 (#644) @dependabot
  • Bump com.jfrog.artifactory from 5.1.11 to 5.1.13 (#642) @dependabot
  • Bump org.assertj:assertj-core from 3.24.2 to 3.25.0 (#643) @dependabot
  • Bump commons-io:commons-io from 2.15.0 to 2.15.1 (#639) @dependabot
  • Bump org.apache.commons:commons-lang3 from 3.13.0 to 3.14.0 (#638) @dependabot
  • Bump com.jfrog.artifactory from 5.1.10 to 5.1.11 (#637) @dependabot
  • Bump commons-io:commons-io from 2.14.0 to 2.15.0 (#636) @dependabot
  • Bump com.jfrog.artifactory from 5.1.9 to 5.1.10 (#635) @dependabot
  • Bump commons-io:commons-io from 2.13.0 to 2.14.0 (#634) @dependabot
  • Bump com.jfrog.artifactory from 5.1.6 to 5.1.9 (#633) @dependabot
  • Bump io.jenkins.plugins:pipeline-groovy-lib from 685.v8ee9ed91d574 to 687.v62591d623759 (#632) @dependabot
  • Bump com.jfrog.artifactory from 5.1.5 to 5.1.6 (#631) @dependabot
  • Bump com.jfrog.artifactory from 5.1.4 to 5.1.5 (#630) @dependabot
  • Bump io.jenkins.plugins:pipeline-groovy-lib from 673.vb_c5d5948283c to 685.v8ee9ed91d574 (#629) @dependabot
  • Bump io.jenkins.plugins:pipeline-groovy-lib from 671.v07c339c842e8 to 673.vb_c5d5948283c (#628) @dependabot
  • Bump org.apache.ivy:ivy from 2.5.1 to 2.5.2 (#622) @dependabot
  • Bump com.cloudbees:groovy-cps from 3728.vd5c88eef9154 to 3773.v505e0052522c (#626) @dependabot
  • Bump com.jfrog.artifactory from 5.1.0 to 5.1.4 (#627) @dependabot
  • Bump com.jfrog.artifactory from 5.0.3 to 5.1.0 (#619) @dependabot
  • Bump io.jenkins.plugins:pipeline-groovy-lib from 656.va_a_ceeb_6ffb_f7 to 671.v07c339c842e8 (#618) @dependabot
  • Bump com.cloudbees:groovy-cps from 3726.v83f8cff396c9 to 3728.vd5c88eef9154 (#615) @dependabot

v1.19

9 months ago

(Note: version v1.18 will be skipped due to some problems I had with the Gradle release plugin, since we've already published the tag and artifacts for v1.19. 😅)

👷 Changes for plugin developers

  • Update groovy-cps from 1.31 to 3722.v85ce2a_c6240b_ (#611) @NotMyFault

✍ Other changes

  • Gradle version updated to 8.0 (#597) @atai
  • Support dockerfile agent declaration with filename (#598) @zgyorffi
  • Add documentation about addParam (#594) @nre-ableton

📦 Dependency updates

16 changes
  • Bump com.cloudbees:groovy-cps from 3722.v85ce2a_c6240b_ to 3726.v83f8cff396c9 (#613) @dependabot
  • Bump org.apache.commons:commons-lang3 from 3.12.0 to 3.13.0 (#610) @dependabot
  • Bump com.jfrog.artifactory from 4.33.1 to 5.0.3 (#609) @dependabot
  • Bump com.jfrog.artifactory from 4.32.0 to 4.33.1 (#604) @dependabot
  • Bump commons-io:commons-io from 2.12.0 to 2.13.0 (#603) @dependabot
  • Bump com.jfrog.artifactory from 4.31.9 to 4.32.0 (#601) @dependabot
  • Bump commons-io:commons-io from 2.11.0 to 2.12.0 (#600) @dependabot
  • Bump com.jfrog.artifactory from 4.31.8 to 4.31.9 (#596) @dependabot
  • Bump com.jfrog.artifactory from 4.31.7 to 4.31.8 (#593) @dependabot
  • Bump com.jfrog.artifactory from 4.31.6 to 4.31.7 (#592) @dependabot
  • Bump com.jfrog.artifactory from 4.31.5 to 4.31.6 (#591) @dependabot
  • Bump com.jfrog.artifactory from 4.31.4 to 4.31.5 (#590) @dependabot
  • Bump com.jfrog.artifactory from 4.31.3 to 4.31.4 (#587) @dependabot
  • Bump com.jfrog.artifactory from 4.31.1 to 4.31.3 (#586) @dependabot
  • Bump com.jfrog.artifactory from 4.31.0 to 4.31.1 (#584) @dependabot
  • Bump assertj-core from 3.24.1 to 3.24.2 (#583) @dependabot

v1.17

1 year ago

🚀 New features and improvements

  • Allow declaration of kubernetes agent with no config (#568) @keegangroth
  • Add Map parameter to catchError mock (#571) @Bilgetz

✍ Other changes

  • Require Java 11 for Gradle build, remove Spring framework (#576) @nre-ableton
  • Add note about Groovy 4 compatibility in README (#575) @nre-ableton
  • Improvements to README (#552) @nre-ableton

📦 Dependency updates

  • Bump groovy-all to 2.4.21 (#582) @nre-ableton
  • Bump assertj-core from 3.24.0 to 3.24.1 (#580) @dependabot
  • Bump assertj-core from 3.23.1 to 3.24.0 (#579) @dependabot
  • Bump com.jfrog.artifactory from 4.30.1 to 4.31.0 (#577) @dependabot
  • Bump com.jfrog.artifactory from 4.30.0 to 4.30.1 (#573) @dependabot
  • Bump com.jfrog.artifactory from 4.29.4 to 4.30.0 (#572) @dependabot
  • Bump com.jfrog.artifactory from 4.29.3 to 4.29.4 (#569) @dependabot
  • Bump com.jfrog.artifactory from 4.29.2 to 4.29.3 (#563) @dependabot
  • Bump ivy from 2.5.0 to 2.5.1 (#562) @dependabot
  • Bump com.jfrog.artifactory from 4.29.1 to 4.29.2 (#558) @dependabot
  • Bump com.jfrog.artifactory from 4.29.0 to 4.29.1 (#557) @dependabot
  • Bump spring-core from 5.3.22 to 5.3.23 (#556) @dependabot
  • Bump net.researchgate.release from 3.0.1 to 3.0.2 (#555) @dependabot
  • Bump net.researchgate.release from 3.0.0 to 3.0.1 (#553) @dependabot
  • Bump com.jfrog.artifactory from 4.28.4 to 4.29.0 (#548) @dependabot

v1.16

1 year ago

:bug: Bug fixes

  • Hotfix Make params immutable for declarative piplines (#546) @nre-ableton

v1.15

1 year ago

:warning: Breaking API changes

  • Make params map immutable (#542) @nre-ableton. If your code was (incorrectly) modifying values in params, you'll now get an exception when trying to do this. This won't work on a real Jenkins server, and now it won't work in this framework either. To modify the params map, you must use addParams.
  • mockShOutputs has been renamed to mockShHandlers (see below, #498).

:rocket: New features and improvements

  • script handlers using patterns (#498) @UlrichEckhardt. Previously, helper.addShMock took a String as the first argument for an exact command to match. This method now can take a Pattern to match a regular expression, a String for an exact match (the same behavior as before), or no argument to match anything.

Some examples:

@Test
void testWhatever() {
    helper.addShMock(~/echo\s(.*)/, 'mock-output', 0)
    helper.addShMock('echo "hello, world"', 'mock-output', 0)
    helper.addShMock('default-mock-output', 0)
}
  • feat(DockerMock): calls should show up in the call stack (#535) @stanovchar
  • Generate a default closure in InterceptingGCL (#510) @nestoracunablanco
  • Set currentBuild.currentResult in updateBuildStatus (#517) @nre-ableton
  • Make bindings accessible in SharedLibrary classes. (#519) @nestoracunablanco
  • Add mocks for all basic pipeline steps (#518) @nre-ableton
  • Support "parameters" in scripted pipeline job (#495) @reinholdfuereder

:bug: Bug fixes

  • Fix for shared lib and params variables being null in environment section (#529) @tomek-d
  • bugfix(declarative): Stage with any 2 of parallel, steps, matrix, stages should throw error (#506) @stchar

✍ Other changes

📦 Dependency updates

  • Move away from deprecated Release Drafter App (#497) @NotMyFault
  • feat(gradle): bump version 7.4 (#491) @stchar
  • Bump spring-core from 5.3.21 to 5.3.22 (#544) @dependabot
  • Bump com.jfrog.artifactory from 4.28.3 to 4.28.4 (#539) @dependabot
  • Bump net.researchgate.release from 2.8.1 to 3.0.0 (#538) @dependabot
  • Bump spring-core from 5.3.20 to 5.3.21 (#537) @dependabot
  • Bump assertj-core from 3.23.0 to 3.23.1 (#531) @dependabot
  • Bump assertj-core from 3.22.0 to 3.23.0 (#530) @dependabot
  • Bump com.jfrog.artifactory from 4.28.2 to 4.28.3 (#525) @dependabot
  • Bump spring-core from 5.3.19 to 5.3.20 (#524) @dependabot
  • Bump com.jfrog.artifactory from 4.28.1 to 4.28.2 (#520) @dependabot
  • Bump spring-core from 5.3.18 to 5.3.19 (#514) @dependabot
  • Bump spring-core from 5.3.17 to 5.3.18 (#511) @dependabot
  • Bump com.jfrog.artifactory from 4.28.0 to 4.28.1 (#508) @dependabot
  • Bump com.jfrog.artifactory from 4.27.1 to 4.28.0 (#502) @dependabot
  • Bump spring-core from 5.3.16 to 5.3.17 (#501) @dependabot

v1.14

2 years ago

:warning: Breaking API changes

  • Fix sh default output (#483) @UlrichEckhardt. Specifically, the default output of the sh mock was removed. Formerly, the sh mock would return either abcd123\n for git rev-parse HEAD or \nbbb\nccc\n in all other cases (and a similar output for bat). If your tests relied on this behavior, you must now register proper output for sh commands like so:
@Test
void testGit() {
    helper.addShMock("git rev-parse HEAD", "\nbbb\nccc\n", 0)
    def result = script.sh(script: "git rev-parse HEAD", returnStdout: true)
    assertEquals("\nbbb\nccc\n", result)
}

Please see the documentation for mocking sh for more information.

  • The PipelineTestHelper.mockScriptOutputs field was renamed to PipelineTestHelper.mockShOutputs, in order to accommodate the new PipelineTestHelper.mockBatOutputs field. If your tests called helper.mockScriptOutputs, you can simply rename these usages to helper.mockShOutputs.

:bug: Bug fixes

  • Split withEnv only on first = character (#468) @Brenne
  • Bugfix: mock existing local function. (#465) @nestoracunablanco
  • Align sh mock exception message to AbortException (#471) @nre-ableton
  • Use the same stringInterceptor in declarative and scripted pipelines (#460) @sams-gleb

:rocket: New features and improvements

  • Adds verify method in BasePipelineTest. (#463) @nestoracunablanco
  • Fully implement mocking the bat() function (#484) @UlrichEckhardt
  • Register fileExists mock with mapped arguments (#477) @nre-ableton
  • Replace AppVeyor/Travis with Jenkins (for Windows/Linux builds)/GitHub Actions (for Mac builds) @nre-ableton, @UlrichEckhardt, @dblock
  • Add support for branch/tag comparators in when block (#453) @Alex-Weatherhead

📦 Dependency updates

  • Bump spring-core from 5.3.15 to 5.3.16 (#492) @dependabot
  • Bump com.jfrog.artifactory from 4.27.0 to 4.27.1 (#490) @dependabot
  • Bump com.jfrog.artifactory from 4.26.3 to 4.27.0 (#480) @dependabot
  • Bump com.jfrog.artifactory from 4.26.2 to 4.26.3 (#475) @dependabot
  • Bump com.jfrog.artifactory from 4.26.1 to 4.26.2 (#474) @dependabot
  • Bump spring-core from 5.3.14 to 5.3.15 (#473) @dependabot
  • Bump com.jfrog.artifactory from 4.26.0 to 4.26.1 (#470) @dependabot
  • Bump com.jfrog.artifactory from 4.25.5 to 4.26.0 (#469) @dependabot
  • Bump com.jfrog.artifactory from 4.25.4 to 4.25.5 (#467) @dependabot
  • Bump assertj-core from 3.21.0 to 3.22.0 (#466) @dependabot
  • Bump com.jfrog.artifactory from 4.25.3 to 4.25.4 (#464) @dependabot
  • Bump com.jfrog.artifactory from 4.25.2 to 4.25.3 (#459) @dependabot
  • Bump spring-core from 5.3.13 to 5.3.14 (#458) @dependabot
  • Bump com.jfrog.artifactory from 4.25.1 to 4.25.2 (#457) @dependabot

v1.13

2 years ago

:bug: Bug fixes

  • Fix: executing on agent message logs a binding value. (#444) @dblock

:rocket: New features and improvements

  • Add support for alwaysPull in docker agent (#437) @nre-ableton
  • Add dependabot to repository (#438) @nre-ableton

📦 Dependency updates

  • Bump com.jfrog.artifactory from 4.25.0 to 4.25.1 (#456) @dependabot
  • Bump com.jfrog.artifactory from 4.24.23 to 4.25.0 (#454) @dependabot
  • Bump commons-io from 2.5 to 2.11.0 (#449) @dependabot
  • Bump commons-math3 from 3.4.1 to 3.6.1 (#442) @dependabot
  • Bump commons-lang3 from 3.5 to 3.12.0 (#445) @dependabot
  • Bump ivy from 2.4.0 to 2.5.0 (#446) @dependabot
  • Bump assertj-core from 3.4.1 to 3.21.0 (#447) @dependabot
  • Bump junit from 4.11 to 4.13.2 (#440) @dependabot
  • Bump com.jfrog.artifactory from 4.11.0 to 4.24.23 (#443) @dependabot
  • Bump spring-core from 5.2.9.RELEASE to 5.3.13 (#439) @dependabot
  • Bump groovy-cps from 1.12 to 1.31 (#441) @dependabot

v1.12

2 years ago

🚀 New features and improvements

🐛 Bug fixes

Full Changelog: https://github.com/jenkinsci/JenkinsPipelineUnit/compare/v1.10...v1.12

(Sorry for the confusion with the versioning; something went wrong with v1.11 and although the tag was published, it seems the binaries were not. Hence, v1.11 has been skipped and those changes are included in v1.12).

v1.10

2 years ago

🚀 New features and improvements

  • Adding changeRequest support in when declaration (#395) @clipitar
  • Add inline script feature (#382) @RecuencoJones
  • Provide a mock for the wrap step (#376) @nre-ableton
  • Add input/message mocks for declarative pipelines (#368) @nre-ableton
  • Include tag support in anyOf declarative (#363) @gmattar

🐛 Bug fixes

  • Make CLONE_TIMEOUT a value in minutes, not seconds (#377) @nre-ableton
  • Fix incorrect type declaration in closure (#370) @nre-ableton
  • Avoid using default encoding (#360) @TurboLuke
  • Fix README for "Mocking sh" (#359) @reinholdfuereder
  • Avoid using default charset encoding for writing callstack file (#358) @reinholdfuereder
  • Fix incorrect filename in README example code (#350) @nre-ableton
  • chore: No more Release Release in release notes (#349) @timja

v1.9

3 years ago

🚀 New features and improvements

  • feat: support allOf in a when context (#343) @garethjevans
  • Adding unzip mock (#322) @cwiggs
  • Add fileExists mock with helper methods (#312) @nre-ableton

🐛 Bug fixes

  • Remove obsolete doGenerateSubmoduleConfigurations (#341) @MarkEWaite
  • Remove default values from git plugin example (#339) @MarkEWaite
  • Fix WhenDeclaration environment condition. (#326) @pkwarren
  • Handle failures in sh step with returnStdout (#329) @nre-ableton
  • Fix the buildingTag() method's support (#334) @dduportal
  • Safer lazy initialization of variables (#332) @nre-ableton
  • Allow use of ant path expressions on branch validation (#315) @epsilo
  • fix(declarative) withCredentails usernamePassword mocking conflict (#311) @stchar
  • Update Gradle wrapper to 6.6.1 (#293) @nre-ableton
  • Add test for nesting stages including parallel (#297) @Willem1987
  • Add test for docker agent with Closure param (#296) @Willem1987
  • Fix MissingPropertyException to show the actual property missing (#300) @Willem1987
  • Register timeout with integer argument (#294) @nre-ableton