I have a paramterized test case, for creating a practice contract on the AUT. It is meant to be called from parent test case, namely one that is to create a practice that will end up having that contract.
At the time of writing this, it take two variables:
-
initURL
: the URL of the practice to go to and create contracts on
-
model
: the ContractModel
(we define it, create it using a model builder we wrote, and pass it in from parent test case)
Right now, there is no way, that we know, to have intellisense access to the getters for this ContractModel
, without us having to end up doing this:
'This is only here to enable the intellisense for the model that was passed in'
ContractModel model = model
Also, for whatever reason, we cannot specify its fully-qualified variable type in the variables type. Namely, typing com.[companyName].model.contract.ContractModel
in the Type cell doesn’t work!
How can we tell the testing environment the type of model
, such that we have access to all the getters in the script mode?
Katalon Studio uses Groovy language. Test Case scripts in Katalon Studio are instances of Groovy script.
Groovy is an optionally-typed language. Groovy is different from Java as far as type-constraint is concerned. It relaxes type-constraints intentionally by design. The def keyword of Groovy typically shows the nature of this language. To learn what def
is, see
'This is only here to enable the intellisense for the model that was passed in'
ContractModel model = model
The variable model
on the right-hand side of = is the argument which receives the value passed from the caller Test Case; am I right? I suppose, in Katalon Studio application, the parameters (like model
) are declared with keyword "def"
. Therefore the Test Case Editor is not aware of the concrete class name of the value in the model
variable. Therefore intelliSence does not work on the model
on the right-hand side.
The variable model
on the left-hand side is explicitly declared with type ContractModel
. So the editor is informed of the type. Then intelliSence works for the model
variable on the left-hand side of =.
No, you are not supposed to do it. The testing environment (Katalon Studio) is not designed to be informed of the type of parameters in WebUI.calTestCases(testCase, [...parameters])
.