0

I'm using TestRail API .NET bindings in combination with JavaScript and TestComplete CLR bridge functionaity. I have built the Guorok.Testrail library referencing the Newstonoft.Json library in Visual Studio and I can see the TestRail binding APIClient method in TestComplete (so assuming the bridge is working). When attempting to login TestRail API via script in TestComplte I am encountering this error with the APIClient:

System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
   at System.Net.HttpWebRequest.GetResponse()
   at Gurock.TestRail.APIClient.SendRequest(String method, String uri, Object data) in D:\Users\qa\Desktop\Gurock DO NOT DELETE\testrail-api-master\dotnet\Gurock\TestRail\APIClient.cs:line 189
   at Gurock.TestRail.APIClient.SendPost(String uri, Object data) in D:\Users\qa\Desktop\Gurock DO NOT DELETE\testrail-api-master\dotnet\Gurock\TestRail\APIClient.cs:line 95

I am able to authenticate via Postman but I am having issues doing the same with TestComplete. I'm attempting to update a test case to passed via TestRail API in TestComplete's CLR bridge passing the apiArgsasString, runId, caseId, and dataObj. I've also confirmed the apiArgsAsString are indeed a string, "add_result_for_case/278/43381". I've ensured TestAPI access has been checked in both places in administartion.

Example passCase:

testrail = {};

testrail.passCase = function(runId, caseId, additionalFields) {
    testrail.addStatusAndResultForCase(runId, caseId, additionalFields, 1);
};

testrail.addStatusAndResultForCase = function(runId, caseId, additionalFields, statusId) {
    additionalFields = additionalFields || {};
    additionalFields.status_id = statusId;
    testrail.addResultForCase(runId, caseId, additionalFields);
};


testrail.addResultForCase = function(runId, caseId, additionalFields) {
    dataObj = testrail.dataDictonary(additionalFields);
    testrail.sendPost("add_result_for_case/" + runId + "/" + caseId, dataObj);
};

testrail.sendPost = function(apiArgsAsString, dataDictionaryObj) {
    testrail.apiClient().SendPost(apiArgsAsString, dataDictionaryObj);
};

testrail.dataDictonary = function(jsonObj) {
    var dataD = dotNET.System_Collections.Hashtable.zctor();
    for (var key in jsonObj) {
        if (jsonObj.hasOwnProperty(key)) {
            dataD.Add(key, jsonObj[key]);
        }
    }
    
    return dataD;
};

testrail.apiClient = function() {
    var client = dotNET.Gurock_TestRail.APIClient.zctor("myTestRailURL");
    client.User = "myUsername"; 
    client.Password = "myPassword"; 
    return client; 
   
};
//USEUNIT
function testUpdateTestRail() {
    testrail.passCase(278, 43381, {comment: 'Updated to Passed'});
};

When running the above function I am getting SSL/TLS error above. Has anyone faced this issue before or has had success integrating TestRail and TestComplete? Any suggestions on what to do next would be appreciated!

  • Maybe duplicate of this: https://stackoverflow.com/questions/2859790/the-request-was-aborted-could-not-create-ssl-tls-secure-channel – Sergi Jul 20 '23 at 08:17
  • That was it! I added the tls protocol prior to the SendPost and it worked. Thanks so much for your help! – SuperMarioRPG Jul 20 '23 at 17:25

1 Answers1

0

Issue had nothing to do with the code above and I had to modify the TestRail .NET API bindings with the below code to solve the issue:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

More info: The request was aborted: Could not create SSL/TLS secure channel