I am new to katalon and would appreciate your help. I am creating an object repository to test an api. If it’s run with raw data, it is processed successfully.
Does in_PolicyID refer to a global variable in the Variables tab? You may have forgotten to set the profile. I believe, it is reset to default on every launch. Or maybe you did a typo. It is case-sensitive and all.
And you should see what the request body is like. The request getter is usually a basic snippet in the verification tab:
RequestObject request = WSResponseManager.getInstance().getCurrentRequest()
To get the body you can use:
request.getBodyContent()
Thanks for the reply. in_PolicyID is mapped to a global variable and the value is set. The HAR file also shows that the value is passed in the request.
If this is a GlobalVariable, you have to use ${GlobalVariable.variable_name}.
the form ${variable_name} is to be used when the variable is defined in the test object ‘Variables’ tab.
Not sure how the har file shows that was properly resolved, please re-check.
I defined in_PolicyID with type = global variable and set the global variable in the default.
This is working fine for other object repositories. I also tried replacing it as a local variable and set the value in the default, but it’s still giving the 500 internal server error.
Ah, ok… well, then, something strange happens when the object is doing the interpolation, i guess.
Honestly speaking, I never used parametrization in the body directly, as you do, for this case I usually use a totally different approach, will check the forum and revert.
@roma.taju you have a pretty complex body, so if I will be in your shoes I will use a different approach.
E.g I will store the body template as a file, and do the needed substitutions from a testcase, using the groovy SimpleTemplate engine.
see: Template engines
I made an example of how this can be achieved some time ago, here:
So I suggest to you to build the entire body in a testcase and pass it to the testobject as a single string variable.