Forum Discussion

SaravanaKumar_N's avatar
SaravanaKumar_N
Contributor
8 years ago

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 Te...
  • SaravanaKumar_N's avatar
    SaravanaKumar_N
    8 years ago

    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", "") + "/#";