Test-driven development of Jenkins pipelines :loop: with Jenkins Pipeline Unit
This is a Maven-based project demonstrating how to unit-test declarative Jenkins pipelines with the
help of the Jenkins Pipeline Unit framework.
The build and dependency management of this project is based on Apache Maven.
Run the following command in your preferred shell:
mvn clean verify
This project has the following dependencies:
This project demonstrates how test-driven development of declarative Jenkins pipelines can be done.
For this purpose it relies heavily on the
Jenkins Pipeline Unit framework which allows unit-testing
of Jenkins pipelines.
As is tradition in test-driven development, begin by writing, changing or expanding the Groovy-based unit-tests
in test/groovy/
and ensure that the names your unit test classes end with *Test.groovy
as is
expected by convention. Once your tests fail, start implementing the necessary changes in Jenkinsfile
which is by convention expected to be in src/main/jenkins
.
Once your tests are successful, begin to clean up the mess you made by refactoring your code.
Finally, start over as you expand your Jenkins pipeline .
git checkout -b my-new-feature
git commit -am 'Add some feature'
git push origin my-new-feature
Copyright 2020 Lukas Pradel
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.