ApiCall doesn't accept passed variables

Hello,

recently some of our tests stopped working due to the fact that our ApiCall doesn’t accept passed variable and uses the default one.

Here it is a bit more specifically:

  1. In our test we need to call this request and pass the variables:
    ‘Call Login API_Request’
    apiCall_Login = WS.sendRequestAndVerify(findTestObject(‘Object Repository/API_Requests/Authentication/Login’, [(‘URI’) : GlobalVariable.URI
    , (‘Username’) : Username, (‘Password’) : Password]))
    EDIT: The passed variables Username/Password are test case variables

  2. We have binded test variables in our test suit, specifically:
    Username = admin.katalon.buyer

  3. The API call has default variable:
    Username = admin.JW.buyer

If I run the test locally - everything works fine.
If I run the test remotely (gitlab pipeline on a linux server - not sure if this information is important) there always is this error:
Expected element property value ‘admin.JW.buyer’ is not equal with actual property value ‘admin.katalon.buyer’
2020-03-29 15:27:42.966 ERROR c.k.k.core.keyword.internal.KeywordMain - :x: Unable to verify element property value (Root cause: com.kms.katalon.core.exception.StepFailedException: Expected element property value ‘admin.JW.buyer’ is not equal with actual property value ‘admin.katalon.buyer’

This however doesn’t make sense to me - even if I print out the variable “Username” before the apicall, it says admin.katalon.buyer so how is it possible that the ApiCall verification uses the default variable.

To add all I can:
This is the verification step:
def variables = request.getVariables()
def Username = variables.get(“Username”)

WS.verifyElementPropertyValue(response, "user.userName", Username, FailureHandling.STOP_ON_FAILURE)

And this is the request body:
{
“userName”: “${Username}”,
“password”: “${Password}”
}

All this should be correct. If I change the default variable in our ApiCall to admin.katalon.buyer it passes on our remote server as well but to us that’s not desirable.

Any thoughts and ideas? Please ask for more information if needed.

Thanks

Hi @hynek.svoboda,
Which version of Katalon do you use?

@huynguyen
My local version is 7.2.1 but our remote server uses 6.3.3