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:
  1. retrieve information from Jenkins for programmatic consumption.
  2. trigger a new build
  3. create/copy jobs
This is the format which you should use in GET method mode while sending your request via Postman/ReadyAPI or any other platform
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

Popular posts from this blog

Day 32 - Python Script to track Available COVID-19 Vaccine Slots for 18+ in India

DAY 31 - Organize a Secret Santa Game in your organization using a Python Script

Day 15 - Steps to Import JSON Data-Set in POWER BI & Refresh data-set created from web source in POWER BI