How to pass more than one test object as argument to a method in Katalon


#1

Hi,

I tried to pass two test objects to a method but it accepts only one Test Object.How to pass two test objects to a method?


#2

Hello,

which method do you try to pass two parameters to?


#4

I have created a custom keyword which accepts two Test Objects:

def selectMonthAndYear(TestObject testObj1,TestObject testObj2){
//code definition
}

While calling the customkeyword in a TestCase(created under Testcase folder), I tried to pass two test objects but it accepts only one testobject as parameter.


#5

What error do you get when you enter two TestObjects?


#6

Thanks for your time and support.I understood that under object column in test case we can give only one test object but under input we can give remaining test objects.


#7

Oh, I see. Simply switch to script mode and put parameters directly to keyword method.


#8

Thanks. And I have a small doubt:

Is there any possible way to create dynamic test objects instead of writing them in scripts?

Ex: Create a test Object under ObjectRepository folder with xpath as “div[@id=’%s’]” and pass values dynamically to that TestObject in script


#9

It is, but having them in scripts is IMO better.

Read the chapter about parametrizing objects.