Integrate TestLink with Jenkins and JUnit for Automated Test Reporting
This guide walks through setting up a Windows environment with TestLink, Jenkins, and Eclipse, adding JUnit support, configuring TestLink custom fields, and creating a Jenkins freestyle job that runs Ant builds, invokes TestLink, and publishes JUnit test results for seamless automated reporting.
This document assumes an existing TestLink project; if you are using TestLink for the first time, create a test project, test plan, and test cases before proceeding with Jenkins integration.
Prerequisites: Windows 10 64‑bit, TestLink, Jenkins, and Eclipse installed. Access TestLink at http://<em>IP</em>:<em>port</em>/testlink (e.g., http://localhost/testlink) and Jenkins at http://localhost:8080.
In Eclipse, add the JUnit library (version 4.0 or higher) via Build → Add Library → JUnit → Next → Finish. Export the project as an Ant build file (build.xml) through
Export → General → Ant Buildfiles → Next → Select project → Finish, which creates a build.xml file in the project root.
Create an empty junit folder alongside the build.xml. Run the Ant build by right‑clicking build.xml → Run As → Ant Build.... The build generates XML reports in the junit folder; the index.html file shows a table of test execution results.
In Jenkins, install the required plugins: TestLink Plugin , Ant Plugin , and JUnit Plugin via Manage Jenkins → Manage Plugins → Available.
Configure TestLink: go to System → Custom Fields → Create and add a field (e.g., name and label both set to the same value) that will store the JUnit class name. Assign this custom field to the desired test project via Test Project → Assign Custom Fields.
Edit a test case in TestLink, click the “Set” button, and fill the java_class field with the fully qualified class name (e.g., junit.CalculatorTest) and select “Automatic” execution mode. Save the changes.
In Jenkins, create a new freestyle project. Under Source Code Management , specify the Git repository URL of the Java project. Add a build step Invoke Ant and set the Target to the name defined in build.xml. Add another build step Invoke TestLink and fill in:
TestLink Version (e.g., 1.9)
Test Project Name
Test Plan Name
Build Name (any identifier)
Custom Fields (the field created earlier)
Test Plan Custom Fields (same as above)
Result Seeking Strategy → Add strategy → JUnit class name
Include Pattern – path to the generated JUnit XML report
Key Custom Fields – same custom field used in TestLink
Add a post‑build action Publish JUnit test result report, setting the test report XML path to the same Include Pattern.
Save the job and trigger a build. After a successful build, Jenkins displays the TestLink results: test cases linked via the custom field show “Passed”, while unlinked cases appear as “Not Run”. The TestLink UI now reflects the automated execution status.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Full-Stack DevOps & Kubernetes
Focused on sharing DevOps, Kubernetes, Linux, Docker, Istio, microservices, Spring Cloud, Python, Go, databases, Nginx, Tomcat, cloud computing, and related technologies.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
