I have made a demo project on GitHub, with it you can reporoduce the problem
Problem to solve
I use JUnit inside Katalon Studio to do unit-testing over custom keywords as I described at another post. During that exercise, I often need to rename Groovy packages.
In the sample project, I have a file Include/scripts/groovy/my.packageY/GreeterTest.groovy
, and wanted to move it to Include/scripts/groovy/my.packageX/GreeterTest.groovy
.
I tried renaming it with Katalon Studio’s UI. In the Test Explorer, select the Include/scripts/groovy/my.packageY
and mouse-right-click to choose Rename
to my.packageX
. Then the dialog rejected renaming with message Inputted package already exists
.
In the Include/scripts/groovy
directory there is NOT a package my.packageX
. Therefore, no reason why I can not rename my.packageY
to my.packageX
.
Reason why KS behaves as such
In the Keywords
directory there was a package my.packageX
. This seemed to be the reason why KS rejects my request. KS checks duplication of package names in the Keywords directory and the Include/script/groovy directory mixed.
What’s funny
It was funny to find that I could add my.packageX
under the Include/scripts/groovy
directory while KS rejects renaming my.packageY
to my.packageX
.
How significant is it?
I often do refactoring of package names for code clarity. This restriction (I can not rename packages under Include/scripts/groovy) makes the refactoring difficult.
However, I am aware that just a few people uses the Include
directory. Any problems occurring in this directory would not affect to users a lot.