What is the fastest way of relinking objects to their respective test case

I have some test cases that have over 400 objects, if I want to rename the test case or the folder where the objects are stored, Im losing linking and the test case will fail every time

I can re-record the test case or I can open the test case and add each object again but its very time consuming and makes portability of tests imposibile to run on a diff machine with diff folder structure.

QUESTION:

What is the fastest way to re-link a test case to folder with a set of objects that are only pertinent to that particular test case.

@cat

What version are you using ? It seems like a bug, since changes by refactoring test object and test case folders should be reflected in test cases and test suites. Does it not work consistently ?

@ThanhTo

I`m using 7.7.0.

Well I learned the hard way, renamed my test cases and re-sorted everything in folders and each test cases needed to have its own set of objects on different folders, didnt expect to lose the linking.

Yes, its consistent. how to replicate.

Begin a recording
Name/save test case
Create a folder, name it
Move newly created recording on that folder - Will break the linking
Create a folder, name it
Move newly created objects from repository on that folder (Still on root object repository folder) - Will break the linking

So there are the 2 ways of breaking this.

Thanks @cat

Have you seen this behavior this on earlier versions as well ? Or is it something that was just introduced recently ?

@ThanhTo

I`ve only used 7.7.0 after getting a license to this depth, I cant tell if older versions were having same issue. Thanks for confirming is a bug. Looking forward to see it fixed.

So mentioned approaches are the only available solutions ?

Thanks.

I found a way, its not easy but if you have to relink thousand of objects there is no other faster way.

TLDR; .groovy file type is where the path to the new object is stored, do a search for old location and replace with new location

Close Katalon studio.

Depending on you structured the folders where the test cases resides this will be different from user to user
Usually is:
C:\Users\USERNAME\git\TEST_FOLDER\Scripts
Inside that folder there will be a “Script_RANDOM_NUMBERS_.groovy”
Open the .groovy file with a text editor.
The content of the file is the same as when you open a test case in script mode, should look something like this
“WebUI.click(findTestObject(‘01_Images/input_Hide thumbnail title_file_contentthum’))”
For me “01_Images” is the subfolder where the objects reside
And “input_Hide thumbnail title_file_contentthum” is the object name
If you`re using windows, navigate to “01_images” and search for *.groovy
All scripts should appear on the search result.
Using a capable text editor, like notepad++, drag and drop all search results/script to your text editor.
Do a “search and replace” action, search for old folder location and replace with “01_Images”
Save everything. The new location should be updated and all objects should work as when was recorded.

@cat

Thank you, I will have our team reproduce this. If it’s reproducible, I’ll let you know when a fix is available.

@cat, I cannot reproduce your issue. Can you record your screen with the issue?

provided you know exactly where and what what to replace, to automate the process you can use the sed tool.
although it is a linux native app, it is available for windows too:

@Loan_Tran @ThanhTo

Since I cant upload mp4s, here is a GIF, is 1 min and 31 sec long.

Katalon reports that the object cant be relocated but will attempt to relocate some of the files or create a duplicate.

That will break the linking.

![Cant_move_objects__to_gif|50x37] (upload://5BCCjJ0zXIUP4XOGEtGGb8OBA3J.gif)

EDIT: Looks like the GIF was converted and is very small.

This migh be better MP4 - https://gofile.io/d/uKaKfF