Please let us know what you are using Katalon Studio for?
- I’m exploring the tool
- I’m learning automated test with Katalon Studio
How would your work be affected if this issue has not been resolved?
- I can continue my job, but my performance is lower than expected
Operating System
Katalon Studio Version
8.2.5
Katalon Studio logs
- Windows logs folder: \config.metadata.log
Screenshots / Videos
Environment (for Web testing):
Browser and Browser version
Steps to reproduce:
As the title says, Katalon auto-unfold my code in script mode every time I start typing. For example a new variable, a new function, or when I open double quotes etc. It’s really annoying that I spend time on re-fold the auto-unfolded code. Especially when code is not just a few lines…
I tried to reproduce what you saw on my Mac.
- I created a new Katalon Studio project. I used version 8.2.5 on Mac os 12.2.1
- I created a new Test Case named “Test Cases/New Test Case”
- I typed in the following codes in it:
public class Main {
public static Test() {
System.out.println("I am Test")
}
public static TestOne() {
System.out.println("I am TestOne")
}
public static TestTwo() {
System.out.println("I am TestTwo")
}
}
- Manually I fold the 3 methods as follows
- At the line#3 I typed
public
- Then the 3 methods were auto-unfolded, as follows
Yes, I could reproduce what @simos reported.
I think that Katalon Studio was confused by the code @simos.sigma wrote.
You wrote
public class Main {
This is a Groovy class definition.
In the “Test Cases” folder, Katalon Studio does not expect your script to start with a Groovy class definition. Katalon Studio require you to write a Groovy script as a “Test Case”.
So Katalon Studio could not understand what @simos.sigma wrote. Therefore it does irrational auto-unfolding.
I rewrote the code in the format of Groovy script:
Katalon Studio did not do auto-unfolding at all.
@simos.sigma
I think @kazurayam has solved this. Using main() {}` in a script class is likely a no-no.
You may not be aware that, behind the scenes, when you write a Test Case like this:
// Imports
// Step 1
WebUI.whatever(...)
// Step 2 ...
// Step 3 ...
// End of Text Case
What you end up with is something like this:
// Imports
class main extends ScriptClass {
def run(...) {
// Start of your Test Case Steps
// Step 1
WebUI.whatever(...)
// Step 2 ...
// Step 3 ...
}
}
Moving this out of Bug Reports.
@kazurayam @Russ_Thomas Hm… It happens even when I use defs only…

That might be expected behavior – it’s trying to show you where the error is located.
In a Eclipse document Preferences > Java > Editor>Folding, I found a description:
Members | If enabled, Java members are folded when opening a new editor.
Please note that this preference is effective only “when opening a new editor”.
This is Eclipse design, not of Katalon Studio. I suppose that Katalon people can not modify this behaviour.
Possibly. But it’s too kind for @simos.sigma.
So the quickest remedy for @simos.sigma would be:
He should
- first, fix the syntactical errors
- close the editor
- reopen the editor
@simos.sigma You don’t have to re-fold defs one by one manually.