The character limit on Test Objects in the Object Repository

I’ve hit a brick wall in my refactoring…

I just created a feature for my project’s PracticeListPage, that involves several TestObjects I have stored in the Object Repository:

image

Now I realized that, another list page needs these features, and that these TestObjects are usable on that list page. So, I go to move them to the shared repository, namely to a folder that’s 4 levels down:

image

and the move is only partially successful. The reason? The move would cause most of the test objects’ names to exceed 256 character limit.

What is this limit coming from, and what could I do about it, short of breaking my conventions with the naming?

It’s a historical Windows OS limitation.

Search Google with keyword “Windws long file name”, you will find a lot to read. For example,

Please note this registry hack is effective only on a machine you are on. Your collegues who shared your project would have the problem recurring on their machine. So I personally don’t see the registry hack as a solution.

Alternatively, you may want to make your Object Repository shallower; don’t make the folder tree too deep. You should move the folder of your resusable Test Objects to some levels upper.

You should be able to rename the folders shorter as well. E.g, “Page_Zoho shared repository” → “ZohoShared”

Or, you should move the project directory to upper level. For example,
C:\Users\foo\bar\baz\0123456789\0123456789\0123456789\0123456789\0123456789
C:\Users\foo\bar\poo

1 Like

You can also shorten your “pathway” a bit by removing the phrase, “Object Repository/” from your objects’ pathway. I know it is small but it may assist some.
So, from this (full id):

WebUI.verifyElementVisible(findTestObject('Object Repository/myPage/input_Sales.Special'))

to this (relative id):

WebUI.verifyElementVisible(findTestObject('myPage/input_Sales.Special'))
1 Like

No, it does not help.

Windows has a limit over the length of absolute full path of a physical file, like “C:\Users\foo\bar\01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789”.

TestObject with id 'Object Repository/myPage/input_Sales.Special' and 'myPage/input_Sales.Special' : both are linked to a same physical file. If one causes a length problem, the other will do so as well.

Yup, I had to adopt a new convention with how I name things in the Shared Repository folder.

Hell, with part of that naming convention, I saw that I could merge another shared repository folder into the Page_Zoho shared repository. Also, that name was only chosen because it followed the naming convention of the Katalon Object Spy/Recorder naming convention (any code generated by it in my project is now-legacy code)…

Notice that, instead of [parent_widget_folder_name] [widget_part_name] I now just say [widget_part_name]. I hate how ambiguous it makes the Test Objects especially when you have multiple of that type open at once, but it is way more concise, without sacrificing readability, and is working.