Forum Discussion
Thanks again for taking time to reply.
There's no paths involved here. If you look the function I'm calling:
function testUpdateTestRail() {
testrail.retestCase(13, 3486);
}
has only two parameters on it. Test run and Test case number both hardcoded integers just for testing the connection between TestComplete and TestRail.
If you follow the scripts posted by schef you'll see there's no file paths either.
On the other hand... how do I get to see the Json being sent.... no idea and it'd be great to know even for future debugging.
Cheers,
Leandro
Sorry. My mistake in my previous post.
You are quite right. It's the JSON parser that's throwing the error.
I'm afraid I don't know why. The TestRail method must be passing something into it, which it doesn't like. (Or the DLL is bugged I guess?) Not sure how you debug it to allow you to actually inspect the JSON. Don't know what options are available to you here. I doubt you can step into external DLL code via the TC debugger?
Having never used any of this stuff, and not being an expert in JSON parsing, I'll need to leave this one for someone who knows the area better.
Looking at it, this is the TestRail method it ends up in:
http://docs.gurock.com/testrail-api2/reference-results#add_result_for_case
You only pass it a Test ID and a Run ID. So it must be interpreting something in the TC run to generate it's status to hand off to the API. As that's the point of the call. To update the test result/status.
The request should be generated to look the same as:
http://docs.gurock.com/testrail-api2/reference-results#add_result
... which can accept various additional fields. But the script looks like it only adds a status. (And any additional stuff you put in the call .... which is nothing in this case)
** BRAINWAVE! **
Hang on. This may be the same as TFS. In TFS-Land (I wrote my own extensions to do much the same as you're doing with TestRail) a Test Case moves from run to run. The Case ID stays the same, but the Test ID changes as you move it on from run to run.
Your method has to take in a Run ID and Case ID.
You mention passing it a Test ID. I wonder if you need to use one of the other methods (ie. runIdAndCaseIdFromTestId ) to get the Case ID and then use the ID it passed back to update the actual result?
Maybe give that a try?
- leandropoblet8 years agoFrequent Contributor
Hi Colin,
From the original usage post I'm trying the simplest one "retestCase" which has no comments, no version, only test run and test case numbers as explained in the post.
//USEUNIT TestRail
function testUpdateTestRail() {
testrail.retestCase(4683, 866867);
testrail.passCase(4683, 866868, {version: 'Build 10.0.0.1234'});
testrail.blockedCase(4683, 866869, {comment: 'Blocked due to JIRA-4321'}); testrail.failCase(4683, 866870, {comment: 'Failed. JIRA-5678 logged.', version: 'Build 10.0.0.1234'});
} - joseph_michaud8 years agoModerator
Everything goes through testrail.addResultForCase() to do a POST. Is sendPost() having a problem trying to parse dataObj created in the call? For the purpose of experimentation, what would happen if you hacked it to post something simple (like a string)?
testrail.addResultForCase = function(runId, caseId, additionalFields) { // dataObj = testrail.dataDictonary(additionalFields); testrail.sendPost("add_result_for_case/" + runId + "/" + caseId, "simplestring"); };
Do you still get the parse exception?