Day 27 - Useful Jenkins REST API endpoints to retrieve TestComplete script result
We've come a long way together through the hard times of manual testing.Now ask is to automate everything.
I have seen QA folks who are putting lot of efforts to automate manual testing using TestComplete tool. That's not enough. Their next job is to monitor these jobs and make sure that it's running successfully at Jenkins.
We should utilize REST API feature to retrieve details of Jenkins job in POSTMAN itself.
Remote API can be used to do things like these:
- retrieve information from Jenkins for programmatic consumption.
- trigger a new build
- create/copy jobs
JENKINS_URL/job/JOBNAME/build/TestComplete/api/xml
Or
JENKINS_URL/job/JOBNAME/build/api/json
Get Build Status
1. Specific build number
http://<jenkins_url>/job/<job_name>/<specific_build_number>/TestComplete/api/xml
Response:
<tcSummaryAction _class='com.smartbear.jenkins.plugins.testcomplete.TcSummaryAction'>
<report>
<agent>VM_NAME</agent>
<details>
<duration></duration>
<errors>0</errors>
<timestamp></timestamp>
<warnings></warnings>
</details>
<error>error_message</error>
<exitCode></exitCode> -- 0 for success --2 for error
<failedToStart>false</failedToStart>
<success></success> --true for success --false for failure
<testName>testcase_name/main</testName>
<url>web_url_of_the_test_case</url>
</report>
</tcSummaryAction>
or
http://<jenkins_url>/job/<job_name>/lastFailedBuild/api/xml
This command would provide result in more expanded form !!!
2. Last build
http://<jenkins_url>/job/<job_name>/lastBuild/TestComplete/api/xml
3. Last successful build
http://<jenkins_url>/job/<job_name>/lastSuccessfulBuild/TestComplete/api/xml
4. Last failed build
http://<jenkins_url>/job/<job_name>/lastFailedBuild/TestComplete/api/xml
5. Console Output
http://<jenkins_url>/job/<job_name>/<specific_build_number>/consoleText
6. List out all the job names which are appearing on the specific Jenkins page
http://<jenkins_url_of_specific_page>/api/xml
#RR #Day27 #Jenkins #RestAPIs #Postman #HappyLearning #WeLearnEveryday
Comments
Post a Comment