Error when verifying if response contains a string

Hello Team,

I am getting below error.

I am trying to combine both web test and api test. The overview is I am placing an test order and then sending a web service request to verify it.

        // Saving checkout URL to variable

        checkout_url = WebUI.getUrl()
	WebUI.println('Checkout Url is ' +checkout_url)

        // Parsing checkout token from the url
	checkout_token = checkout_url.split("/")[5]
	WebUI.println('Checkout token from checkout url ' +checkout_token)
	// Setting Global Variable Value for checkout token so that it can be used to query API
	GlobalVariable.GV_Checkout_Token = checkout_token

        // Sending GET request to checkout token as a parameter

       order_data = WS.sendRequestAndVerify(findTestObject('API/Retrieve a specific order', [('checkout_token') : GlobalVariable.GV_Checkout_Token]))

       // Verifying if response contains checkout token
			WS.containsString('order_data', GlobalVariable.GV_Checkout_Token, false)

I am getting below error when I run the script

groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords.containsString() is applicable for argument types: (java.lang.String, java.lang.String, java.lang.Boolean) values: [order_data, 63ed07bb9daed5a1f5ed47555f7638ca, false]
Possible solutions: containsString(com.kms.katalon.core.testobject.ResponseObject, java.lang.String, boolean), containsString(com.kms.katalon.core.testobject.ResponseObject, java.lang.String, boolean, com.kms.katalon.core.model.FailureHandling)

WS.containsString('order_data', GlobalVariable.GV_Checkout_Token, false)

You are not supplying the correct types to containsString

The first param is a ResponseObject, NOT a string.

1 Like

Thanks it worked