Reputation: 5894
Is there an example of how to do testing against the Jenkins Workflow groovy DSL?
Something similar to the example for the Jenkins Job DSL.
Upvotes: 1
Views: 939
Reputation: 1229
What I've done, is that I created a complete dev-test environment. I did it by using a docker-compose file that includes: jenkins, gitlab, and archiva. I push to a "jenkins-test" origin and run the workflow in the safe "test" environment.
Here's my docker-compose in case someone is interested as a starting point, or as a simple test env: https://github.com/portenez/dry-dock
it's not fully automated, but it's a good start.
Upvotes: 1
Reputation: 25471
No, running a workflow script requires Jenkins to actually be running (since most of what it does is interact directly with Jenkins features like slaves and test results), so the only way to test it is to have a test Jenkins server and run it. By far the most convenient ways to do that in a fully automated way are:
JenkinsRule
in the Jenkins test harness, like plugins would do in their test sources. Exampleacceptance-test-harness
project as a dependency to create integration tests driven via Selenium. ExampleUpvotes: 0