I experienced something strange while editing the testcase in manual mode. Some actions I updated in manual mode, in the script there is code that I commented first before I updated (manual mode). Once the update is complete, I go back to script mode and the code I commented out disappears. is it like that or is this a Katalon bug?
Switching from manual mode to script mode, your test case code will be re-generated by Katalon Studio, resulting in something you did not expect to see.
FYI: When you add a new step, edit, delete or move test steps in Manual View, Katalon Studio will re-generate your script. If you do nothing in Manual view then switch to Script view, your script will remain the same.
I guess, the Manual mode of Test Case editor in Katalon Studio is built on top of the Groovy language’s “Abstract Syntax Tree Transformation” feature.
The Manual mode reads the Groovy source of a Test Case to compile it to generate an instance of Abstract Syntax Tree and keep it in memory.
When you modify the test case in the manual mode, the editor transforms the AST instance to store your instructions.
At this stage, the test case editor no longer remembers how the original Groovy source was coded.
When you switch the editor from the manual mode to the script mode, Katalon Studio serializes the AST instance to a Groovy source code. In other words, the test case code is regenerated.
The processing of “from AST to Groovy source serialization” is designed on its own. The serialization processing is not designed to preserve any comments which were originally there in the source. It formats all the String literals as it thinks appropriate. Therefore in the script mode you will find the source which is quite different from what you had previously.
… I guess as such, but I am not sure. I have never seen the source code of the Katalon Studio GUI (an Eclipse-based SWT app) because it is not open sourced. Just I have ever seen a symbol "AST" somewhere in a stacktrace message years ago, that is the only reasoning of my guess.
Once I wrote that I think that Katalon team would NEVER address this fossil bug.
Still I don’t think they would dare to change the current design of Test Case Editor on top of the “AST” because it is too fundamental to re-invent.