Follow the below given steps to insert the desired function in the script:
Choose the script from the tree node in which you want to insert the function.
Click on the Insert Built-in Functions link placed above the script editor toolbar options at the top right corner.
You should choose the category to which the function belongs. Based on the selected category, the functions list will be populated.
Then, choose the desired function.
Click on the button "Paste" which will insert the selected function statement at the cursor location.
The list of functions that can be inserted are given below:
|
Built-In Function |
Purpose |
Syntax |
Return Value |
|---|---|---|---|
|
Response Validation Functions |
|||
|
getExecutionTime |
To get the execution time of the request sent and the response received from the webservice server. |
getExecutionTime() |
long
|
|
hasFault |
To check whether there is a fault or not such as error in sending request from the client to webservice server or receiving response from webservice server or any connection error, etc |
hasFault |
true or false |
|
getFault |
To get the fault string, if hasFault is true. |
getFault() |
String |
|
getResponseCode |
To get the response code such as 200, 302, 404, etc. |
getResponseCode() |
String |
|
getResponseStatus |
To get the response status message corresponding to the response code. |
getResponseStatus() |
String |
|
General Functions |
|||
|
displayMessage |
To display user defined message in the logs. |
displayMessage("Message to be displayed") |
NA |
|
reportStatus |
To display user defined status in the script reports. |
reportStatus("Status Id", result, remarks)
Status Id is user defined; any value can be specified for identification. result can be 0 or 1 only. 0 for Success and 1 for Failure. remarks can be any textual comment to be displayed in the reports. |
NA |
|
reportTestCase |
To display the test case status (passed or failed) in the test case report. |
reportTestCase(caseid,result,remarks,severity) caseid = ID to be displayed in the reports. result = 0-passed ; 1-failed remarks = Remarks to be displayed in the reports. severity = Severity of the case. |
NA |
|
saveResponse |
To save the response received from the web service server. |
saveResponse("<wsdl_xml_file_path>") |
NA |
|
setProperty |
Sets the value for the selected property such as timeout, maintainSession,username and password. |
setProperty("<property_name>","<value>") |
NA |
|
wait |
To wait until the specified timeout value. |
wait("<timeout_value>") |
NA |