No signature of method error

Hi Guys,

Hoping someone can help me here. I’m trying to integrate Katalon Studio with TestRail and I’ve been stuck on an error message for few days now and cannot get my head around it. Please see the error below:

Test Cases/TestRail_UpdateRun_Results FAILED because (of) (Stack trace: org.codehaus.groovy.runtime.metaclass.MissingMethodExceptionNoStack: No signature of method: egress.Testrail.update_run() is applicable for argument types: (java.lang.String, java.util.ArrayList) values: [14309, [465888, 629906, 510700, 510701, 672572]]

_Possible solutions: update_run(java.lang.String, java.lang.String)

_Below is the code for the update_run:

	@Keyword	def update_run(String id, String array) {		def slurper = new JsonSlurper()		RequestObject ro = new RequestObject('Update TestRail test run')		ro.setRestRequestMethod('POST')		ro.setRestUrl('https://%Testrail URL is here%/index.php?/api/v2/update_run/'+id)		def httpheader = new ArrayList<TestObjectProperty>()		httpheader.add(new TestObjectProperty(				'Content-Type', ConditionType.EQUALS, 'application/json'))		httpheader.add(new TestObjectProperty(				'Authorization', ConditionType.EQUALS,				'%Credentials are here encoded to base64%'))		ro.setHttpHeaderProperties(httpheader)		def body ='{"include_all": false,"case_ids": '+ array +'}'		WebUI.comment('body='+body)		ro.setBodyContent(new HttpTextBodyContent(body, 'UTF-8', 'application/json'))		def response = WSBuiltInKeywords.sendRequest(ro)		return slurper.parseText(response.getResponseText())	}

I’ve attached the script form the test case that uses the above code from the Keyword file. Any help is appreciated.

Many thanks,
Jay

update_run_script.JPG

update_run() method expects two strings as parameters, but you are passing an array as the second parameter:

def total_tcs_to_update = [].

Maybe try passing total_tcs_to_update.toString()?

Hi Mate,

Thank you for responding. I tried doing that however it throws the following error :

tostringerror.JPG

FIrst, bring your code back to the original.

And then, you have this.

response = CustomKeywords.'egress.Testrail.update_run'(
               GlobalVariable.G_testrail_run_id,
               total_tcs_to_update)

Change this to:

response = CustomKeywords.'egress.Testrail.update_run'(
               GlobalVariable.G_testrail_run_id,
               total_tcs_to_update.toString())

Hi @4280-kazurayam , that seems to have worked. Many thanks :smiley:

However, I am now having a different error in terms of TestRail Integration:

11-05-2018 05:07:32 PM - [INFO] - response={error=Invalid or incomplete JSON string in API request.}

Here is the code for it:

response = CustomKeywords.'sync.EgressTestrail.update_run'(GlobalVariable.G_testrail_run_id, total_tcs_to_update.toString())WebUI.comment('response=' + response.toString())String request = '{"results": ['def status_idfor (def n : (0..total_tcs_to_update.size)) {    if ((total_tcs_to_update[n]) != 'null') {        if ((GlobalVariable.G_run_testrail_tc_status[n]) == 'PASSED') {            status_id = '1' //passed            //retest        } else {            status_id = '4'        }                request = request.concat(((('{"case_id":' + (GlobalVariable.G_run_testrail_tc_id[n])) + ',"status_id":') + status_id) +             ',"comment":"Automation ran by Katalon"}')     }}

I was able to solve this by using double quotes vs single quotes around include_all and case_ids in the update_run method:

def body ="{\"include_all\": false, \"case_ids\": " + array + "}"

Or if you dont want to use escapes, this should work as well:

def body ='{"include_all": false, "case_ids": ' + array + '}'

See the “Request Example” for “update_run” here.
My experience has been that if you just copy and paste the code provided by Katalon Studio for TestRail integration, it wont work. So reference the TestRail API documentation and keep an eye out for loop index bounds, etc.

1 Like

Just FYI - we’ve built a TestRail integration plugin for Katalon Studio. If you have any feedback or suggestions we are happy to hear from you.

https://store.katalon.com/product/13/TestRail-Integration