Variable binding at Test Suite level for variables defined in a web services object

As of 5.7, the feature to define variables for a web service object is very useful. However, these variables that automatically map within test cases that call the web service object are not available for binding at the Test Suite level (for data iteration purposes). Variables that are defined at the Test Case level as opposed to at the Test Object level are available for binding for data iteration, but these cannot be referenced inside the web service test objects. Is there a way to have both variables defined at web service test object level and available for binding in Test Suites?

Thanks in advance for any responses.

1 Like

This is a fairly critical issue. We are banging away at this SOAP service for delivery and didn’t realize that it wasn’t accepting data from the data source in the Test Suite. This makes SOAP testing somewhat useless if we cannot pass data to change the request.

At this point I have tried this workflow:

1. Created a datafile called MAC-MTA that is an imported Excel File
2. Created a global variable called G_MTAMAC and made its value findTestData(‘MAC-MTA’)
3. Created a soap request (modemMTAPoll) that defines a variable called MACMTA that is defined as G_MTAMAC. I have used $(MACMTA) within the request
4. Created a testcase that sets:
response = WS.sendRequest(findTestObject(‘WHC SOAP/modemMTAPoll’, [(‘MACMTA’) ; GlobalVariable.G_MTAMAC]))
5. Created a test Suite that does the following:

  • Sets Test Data to the MAC-MTA data file
  • Sets Variable MACMTA to GlobalVariable.G_MTAMAC, Data Columns that then defines those.

6. When I run the test suite (with 44 different inputs) I see that the test cases are being correctly populated with the data from the datasource. However, that data is not being passed to the SOAP Request.

I am certain I am doing something obvious and dumb here. Please…thoughts or I have to hand test for the client by Monday. I’d much rather automate the results.

How it is the data file binded to the test case?

I think you have to define a simple variable (string or what is expected from the excel file) which should have the same name as what is expected from the data file. You can set also a default value, it won’t harm, to quickly execute just the TC and see if is running fine.

In the test suite, add your test case and bind to it the data file you need.

(see this guide for data binding: https://www.katalon.com/resources-center/tutorials/data-driven-testing/ )

In the testcase, when you do the request, call it with somethin like (‘WHC SOAP/modemMTAPoll’, [(‘MACMTA’) ; TC_MTAMAC])), where TC_MTAMAC is the variable defined in the test case, and it should execute just fine replacing the MACMTA in the request with the values from test data.

Spot on with your response. I reworked the test cases and it works like a charm now. Thank you, thank you.

My original question remains unanswered. Is there a way to have variables defined at the web service test object level and have these variables available for binding in Test Suites?

as far as i know, you cannot add into a test suite directly a web service object.

in the test suite you add a test case.

so in the suite you bind the variables to the testcase and from the testcase you call the webservice with the variables defined in the testcase mapped to the parameters defined in the api request.

The purpose of variables defined directly into the web service, in my understanding, is just to provide some defaults for quick testing.

i think it is possible to map directly the test data into the web service object, by choosing test data as type … but i am afraid it cannot be iterated, you have to choose a single row …

I haven’t tried this to be honest

Thanks Ibus. The following works: “so in the suite you bind the variables to the testcase and from the testcase you call the webservice with the variables defined in the testcase mapped to the parameters defined in the api request.”