https://github.com/francomelandri/testing-jenkins
TDD approach for Jenkins pipelines
https://github.com/francomelandri/testing-jenkins
groovy jenkins tdd
Last synced: 12 months ago
JSON representation
TDD approach for Jenkins pipelines
- Host: GitHub
- URL: https://github.com/francomelandri/testing-jenkins
- Owner: FrancoMelandri
- Created: 2019-02-08T07:40:15.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-22T10:10:59.000Z (about 7 years ago)
- Last Synced: 2025-02-05T04:51:17.714Z (about 1 year ago)
- Topics: groovy, jenkins, tdd
- Language: Groovy
- Homepage:
- Size: 31.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# testing-jenkins
### What is
The aim of this repository is to show how you can build your Jenkins pipeline library using a TDD approach. This can help you during development in order to speed up your code.
In addition you are able also to verify the code syntax due the fact the project will be build before running test.
All the code in the pipeline use groovy language
You have to install maven in order to run the test locally
------
### How to use
To launch the test in local environment
```
> nvm clean test
```
If you want to test locally the pipeline test you can run a docker container and then configure jenkins application
```
> docker run \
--rm \
-u root \
-p 8080:8080 \
-v jenkins-data:/var/jenkins_home \
-v /var/run/docker.sock:/var/run/docker.sock \
-v "$HOME":/home \
jenkinsci/blueocean
```
Goto https://localhost:8080 finish the Jenkins setup wizard and setup the Jobs.
First of all you have to configure a **Global Library** called *testing-jenkins* pointing to the https://github.com/FrancoMelandri/testing-jenkins git repo.
You can define two different Jobs
- **Run** as a pipeline Job that launch the *Jenkinsfile*
- **Build** as a pipeline Job that launche the *Jenkinsfile.c*i to ensure the library compile and build
------
### Additional info
How to build a Jenkins pipeline library
https://jenkins.io/doc/book/pipeline/shared-libraries/#global-shared-libraries
Base test library for Jenkins pipeline code
https://github.com/jenkinsci/JenkinsPipelineUnit
How to launch Jenkins locally and build using maven
https://jenkins.io/doc/tutorials/build-a-java-app-with-maven/