Model binding with Web Service Api tests


#1

Hello,

I am having problems with model binding a test case within a test suite. The model binding for each run of the test appears successful as the correct data is displayed in the content. But when the request is being made it is still using the parameters set up in the test case.

In the test case the SendRequest step is set up so that some parameters are of Type Test Data Value, however the default value must have defined row and column numbers. These parameters are not binding to the input data so the same default data is running for each test.

Is there a way to override the row index for the getValue() method from the TestData object to correspond with the number of the currently running test? Can this be done through the UI rather than script (I can code but believe the UI is better for general use).

Thanks


#2

after you bind the testdata to the testcase in the testsuite, make sure you map them too (the window bellow).if the columns in the data have the same name with the variables name declared in the testcase, just hit ‘map all’ and katalon will automagicaly pair them, otherwise you have to map them one by one


#3

Thanks Ibus,

I have completed this step, all the names match including camel casing and it still does not work.

Inside my script for the test case when building the request for a given parameter I have the code:

findTestObject(‘my api/my data’, (‘FromDate’) : findTestData(
‘my data’).getValue(3, 1)

Get value refers to a column and row of my spreadsheet. This value never varies across tests. Column 3 is From Date and each row is the different cases I want to test against.

Thanks


#4

don’t usein your testcase code the ‘findtestdata’. just use the public variable name, that one is substituted at the runtime

with your code,the run is always frozen at (3,1) and is ignoring the testsuite binding


#5

Thank you, that worked!

Just to clarify for anyone else reading:

I set the type of the variable to “Variable” and used the name of the variable as the Default Value.