{"id":19951972,"url":"https://github.com/agarthetiger/jengu","last_synced_at":"2026-05-18T10:06:48.036Z","repository":{"id":131348142,"uuid":"185949766","full_name":"agarthetiger/jengu","owner":"agarthetiger","description":"Test framework for Jenkins libraries","archived":false,"fork":false,"pushed_at":"2020-01-25T20:40:22.000Z","size":32,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-26T23:12:25.714Z","etag":null,"topics":["integration-test","jenkins","jenkins-pipeline","jenkins-pipeline-test","unit-test"],"latest_commit_sha":null,"homepage":null,"language":"Groovy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agarthetiger.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-10T08:26:32.000Z","updated_at":"2023-08-25T08:30:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"fa5fb088-f7ab-47ae-a718-050102724758","html_url":"https://github.com/agarthetiger/jengu","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/agarthetiger/jengu","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agarthetiger%2Fjengu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agarthetiger%2Fjengu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agarthetiger%2Fjengu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agarthetiger%2Fjengu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agarthetiger","download_url":"https://codeload.github.com/agarthetiger/jengu/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agarthetiger%2Fjengu/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33174091,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-18T09:27:30.708Z","status":"ssl_error","status_checked_at":"2026-05-18T09:27:28.300Z","response_time":71,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["integration-test","jenkins","jenkins-pipeline","jenkins-pipeline-test","unit-test"],"created_at":"2024-11-13T01:11:02.649Z","updated_at":"2026-05-18T10:06:48.018Z","avatar_url":"https://github.com/agarthetiger.png","language":"Groovy","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\u003cimg src=\"img/Jengu2.png\" alt=\"Jengu Logo\" width=\"450\" /\u003e\u003c/h1\u003e\n\u003cp align=\"center\"\u003eA lightweight Jenkins Shared Library test framework.\u003c/p\u003e\n\n---\n\n\u003cp align=\"center\"\u003e\u003cimg alt=\"GitHub release (latest SemVer)\" src=\"https://img.shields.io/github/v/release/agarthetiger/jengu?sort=semver\"\u003e \u003cimg alt=\"GitHub\" src=\"https://img.shields.io/github/license/agarthetiger/jengu\"\u003e\u003c/p\u003e\n\nJengu is a test framework to test Jenkins Shared Library code. It was born from necessity while working with Jenkins at scale. See the repo [wiki](https://github.com/agarthetiger/jengu/wiki) for the background to why this project exists. \n\n## Overview\n\nThe purpose of this library is to enable writing automated tests to assert the correct behaviour of Jenkins Shared Libraries. Jengu enables the execution of tests and reporting of the results, it is your job to write good tests for your shared library.\n\nThe entry point is the `libraryTestRunner()` method. This looks by default for files in the workspace using the file glob \"`tests/*Tests.groovy`\". These files will be loaded and any methods annotated with `@Test` from `org.junit.Test` will be executed. The results of the tests will be output into a series of xml files, one xml file per test file, under `output/test-results/` in the workspace. The test results are published using the JUnit plugin (see dependency).\n\n## Getting started\n### Usage\n\nImport this repo as a shared library in a Jenkinsfile in your Jenkins shared library repository. \n\n```groovy\nlibrary identifier: \"jengu@v1.0.0\",\n    retriever: modernSCM([\n        $class: 'GitSCMSource',\n        remote: 'https://github.com/agarthetiger/jengu.git'\n    ])\n```\n\nImporting this library makes the libraryTestRunner() method available to call from your Jenkinsfile. \n\nIn your Jenkinsfile you then need to import your shared library.\n\n```groovy\ndef libraryVersion = (!env.BRANCH_NAME || env.BRANCH_NAME.startsWith('PR')) ?\n    'master' : env.BRANCH_NAME\nlibrary identifier: \"jengu-demo@${libraryVersion}\",\n    retriever: modernSCM([\n        $class: 'GitSCMSource',\n        remote: 'https://github.com/agarthetiger/jengu-demo.git'\n    ])\n```\n\nAs we want to run the tests on feature branches the first line gets the branch name from the Jenkins Environment. \n\nNext you need to also clone your shared library into the workspace. Below is an example using a Declarative Jenkinsfile, this library also works with Scripted Jenkinsfiles. \n\n```groovy\npipeline {\n    agent any\n    options {\n        ansiColor('xterm')\n        timestamps()\n    }\n    stages {\n        stage('Run Tests'){\n            steps {\n                libraryTestRunner()\n            }\n        }\n    }\n}\n```\n\nNote that the test classes in `/tests` will be loaded and executed based on the code checkout to the local workspace, however the methods under test will be executed based on the refspec of the imported library. This can be problematic when trying to test pull requests as it is not possible to checkout a (GitHub Enterprise) PR as the refspec for a shared library (according to CloudBees Enterprise support). \n\n### Example setup\n\nSee the [jengu-demo](https://github.com/agarthetiger/jengu-demo) project for an example of how to incorporate this framework into your shared library project. \n\n## Dependencies\n\n### White-listed methods\n\nIf you're choosing or having to use this library as a Shared Library running in the Groovy sandbox, you will need to get all the following methods whitelisted. \n\n```\nstaticMethod org.apache.commons.lang.exception.ExceptionUtils getStackTrace java.lang.Throwable\nmethod java.lang.Class getMethods\nmethod java.lang.reflect.AnnotatedElement getAnnotation java.lang.Class\nmethod java.lang.reflect.Member getName\nstaticMethod groovy.time.TimeCategory minus java.util.Date java.util.Date\nmethod groovy.time.BaseDuration getMillis\nstaticMethod groovy.xml.DOMBuilder newInstance\nmethod groovy.xml.DOMBuilder createDocument\nmethod org.w3c.dom.Document createElement java.lang.String\nmethod org.w3c.dom.Node appendChild org.w3c.dom.Node\nmethod org.w3c.dom.Element setAttribute java.lang.String java.lang.String\nmethod org.w3c.dom.Document getDocumentElement\nmethod org.w3c.dom.Document createTextNode java.lang.String\n```\n:exclamation: Note that `method java.lang.Class getMethods` will be identified in the Jenkins Script Approvals admin page as a signature which may have introduced a security vulnerability. \n\nThe following method is required by the code in the jengu-demo but is not required for the Jengu library itself. \n\n* method org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper getRawBuild\n\nPersonally I'd recommend enforcing a PR process for this code and loading it as a global shared library, which is not subject to the Groovy sandbox. Despite first appearances this is a more secure deployment because code calling whitelisted methods can change at any point once the method is whitelisted into something unintentionally destructive or intentionally malicious.\n\n### Jenkins Plugins required\n\n* Script Security\n* Pipeline: Utility Steps\n* AnsiColor\n* Timestamps\n* JUnit\n\n## Releases\n\nThis project uses [SemVer](https://semver.org/) for versioning. See the [releases](https://github.com/agarthetiger/jengu/releases) in this repo for available release versions.\n\n## Authors\n\n[Andrew Garner](https://www.linkedin.com/in/buildthethingright/)\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagarthetiger%2Fjengu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagarthetiger%2Fjengu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagarthetiger%2Fjengu/lists"}