Forum Discussion

SaravanaKumar_N's avatar
SaravanaKumar_N
Contributor
8 years ago
Solved

To get URL of TestComplete Test Results of a Jenkins Build

Hi All,

 

I would like to know is there any way in Jenkins to get the URL of TestComplete Test Results.

My requirement is, once the build is completed, I have to send the email with the link of TestComplete Test Results.

As shown in the attachment, I can get the URL of 'image-1' but I would like to get the URL of 'image-2'.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

There could be some jenkins manager build API, that I might not aware of. Any help on this please.

 

Thanks,

Saravana

 

  • Thank you Marsha_R.

     

    I saw that, there was a tag - url, which could be the one I needed. Bur I faced SSLHandshakeException, when parsing the XML file. Of course we could handle it through System admin.

    But instead I took other option - that to find the random number generated for .mht file by the TestComplete plugin. It was available under the Jenkins Home directory.

     

    Following is what I have done to find that and get the URL I needed.

     

    // Frame the Job Path and find the .mht file name
    def jobPath = "${manager.build.getEnvironment(manager.listener)['JENKINS_HOME']}/Jobs/${manager.build.getEnvironment(manager.listener)['JOB_NAME']}/builds/${manager.build.getEnvironment(manager.listener)['BUILD_ID']}/tcreports/";

    // Find the .mht file name

    def fileName = "";
    def files = [];
    new File(jobPath).eachFileMatch(~/.*.mht/) { files << it.name }
    fileName = files[0];

    // Frame the Report URL
    def url= Jenkins.instance.getRootUrl() + manager.build.getUrl() + "TestComplete/dynamic/" + fileName.replaceAll(".mht", "") + "/#";

2 Replies

    • SaravanaKumar_N's avatar
      SaravanaKumar_N
      Contributor

      Thank you Marsha_R.

       

      I saw that, there was a tag - url, which could be the one I needed. Bur I faced SSLHandshakeException, when parsing the XML file. Of course we could handle it through System admin.

      But instead I took other option - that to find the random number generated for .mht file by the TestComplete plugin. It was available under the Jenkins Home directory.

       

      Following is what I have done to find that and get the URL I needed.

       

      // Frame the Job Path and find the .mht file name
      def jobPath = "${manager.build.getEnvironment(manager.listener)['JENKINS_HOME']}/Jobs/${manager.build.getEnvironment(manager.listener)['JOB_NAME']}/builds/${manager.build.getEnvironment(manager.listener)['BUILD_ID']}/tcreports/";

      // Find the .mht file name

      def fileName = "";
      def files = [];
      new File(jobPath).eachFileMatch(~/.*.mht/) { files << it.name }
      fileName = files[0];

      // Frame the Report URL
      def url= Jenkins.instance.getRootUrl() + manager.build.getUrl() + "TestComplete/dynamic/" + fileName.replaceAll(".mht", "") + "/#";