Making Object dynamic?

Hi,

I am running into a problem with my current testcase. Which is the following.
On the website I have 5 complaints (number can vary). Each complaint has an “complaint number”.
This complaint number will always vary and I create this complaint number in another testcase.

However the webpage doesn’t have a “search by complaint number” so I am not able to filter it down and click on the only complaint that is left over… No I have to click the specific one between the 5 complaints.

Now I can easily create an Object for this specific complaint number. But it has to be dynamic. And here is where my problem starts. I have no clue how to do this (if possible).

Ideally I want the Object to look at Excel and get the complaint number from it and then Katalon is able to click on that number.

But I am stuck on how to do this. Is there anyone that might help me with this? :slight_smile:

hello,
when creating complain, just store it’s ID in global variable … this variable can be then used in 2nd TC.

But doesn’t that mean I will eventually have 100+ global variables?
And then the question. How does Katalon know which one to click?

Do you have a list of all possible complaints with related numbers?
If so, I’d create some external data file (json?) and retrieve all required data from that.

No I don’t.
It’s an unique ID and gets randomly generated.

So if I understand it correctly, you create a complaint (and system generates UUID for it) and you need to get this UUID and use it in second test case to search the complaint, right?

i dont see anything wrong with 100+ global variables … if you need them …
which one click? read this please - this is how you can use variable as an parameter in object…

I only use them once.
So having 100+ global variables is data polution.
I already checked that page when you first pointed me towards the Global Variables (I didn’t knew about those before) but I don’t think they will be of use for me.

I also have no problem creating a variable as I can easily get the number from excel and store it into a variable and keep my list clean. The main problem for me is that I am not able to click on that specific variable.

Yes that is correct :slight_smile:

Edit:
Well the search = click.
But that does sums it up.

And do you need to save it for future use? Or is it only a part of one single test run?

The number gets created in another test run.
But I can get the data from Excel and store it into a COMPLAINTNUMBER variable if needed.

You can save it externally no matter where.
I prefer JSON file but Excel would work as well.

Specific implementation depends on what you need - if only latest complaint number or all history.

Not sure I understand what you mean.
In my Excel file I use a specific column where the number is. Which can also be input manually. But in theory it will be the last one created by my previous test case.

data driven testing?
like described here:

Yes, I am already using that.

ok …
and issue is to inject value to object?
obj. def:


and call will look like:
WebUI.click(findTestObject('path/to/object',[('TYPE'):'MY TYPE', ('INDEX'):1]))

Oke, so I stumbled upon a similar page but I can’t get it to work (Using variable in Object's Properties - #43 by kazurayam).

So in my script I have.


And my Object I is defined as

But I keep getting an error
01-20-2020 01:45:13 PM Test Cases/Home (Student2)/Zaken/Page_Huidige zaak

Elapsed time: 0.816s

Test Cases/Home (Student2)/Zaken/Page_Huidige zaak FAILED.
Reason:
groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click() is applicable for argument types: (com.kms.katalon.core.testobject.TestObject, java.lang.Integer) values: [TestObject - ‘Object Repository/Page_Home (Student2)/Zaken/click_Zaaknummer’, …]
Possible solutions: click(com.kms.katalon.core.testobject.TestObject), click(com.kms.katalon.core.testobject.TestObject, com.kms.katalon.core.model.FailureHandling), check(com.kms.katalon.core.testobject.TestObject), check(com.kms.katalon.core.testobject.TestObject, com.kms.katalon.core.model.FailureHandling), back(), wait()
at Page_Huidige zaak.run(Page_Huidige zaak:21)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.RawTestScriptExecutor.runScript(RawTestScriptExecutor.java:34)
at com.kms.katalon.core.main.RawTestScriptExecutor.doExecute(RawTestScriptExecutor.java:29)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
at com.kms.katalon.core.main.TestCaseMain.runTestCaseRawScript(TestCaseMain.java:151)
at com.kms.katalon.core.main.TestCaseMain$runTestCaseRawScript$0.call(Unknown Source)
at TempTestCase1579524311797.run(TempTestCase1579524311797.groovy:59)

remove
,0
from WebUI.click()
WebUiBuiltInKeywords.click() is applicable for argument types: (com.kms.katalon.core.testobject.TestObject, java.lang.Integer)

Lol that worked.
It works now. This solves my problem.
Thanks :smiley:

Youo are welcome…

this is why is best to share ALL information including error messages on beginning…