Run Web Service Request multiple times

Hi,

I created a Web Service Request (POST) and would like to run this test multiple times. For that I created a test case with following script:

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import static com.kms.katalon.core.testobject.ObjectRepository.findWindowsObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows
import internal.GlobalVariable as GlobalVariable

WS.sendRequest(findTestObject(null))

for (int i = 0 ; i < 10 ; i++)
{
WebUI.callTestCase(findTestCase('Name of Web Service Request'), [:], FailureHandling.STOP_ON_FAILURE)
}

What am I doing wrong? Getting Unable to send request (Root cause: java.lang.IllegalArgumentException: Request object is null error message.

Thanks in advance.

Hi @hrashid

WS.sendRequest(findTestObject(null))

is where the error is thrown. Please pass the actual ID of the web service request. Also you’re calling a test case repeatedly in the loop, yet your placeholder is Name of Web Service Request. This doesn’t seem correct. You mmay wat to call WS.sendRequest inside the loop, rather than a test case.