Katalon auto-unfold code in script mode when user start typing

Please let us know what you are using Katalon Studio for?

  1. I’m exploring the tool
  2. I’m learning automated test with Katalon Studio

How would your work be affected if this issue has not been resolved?

  1. I can continue my job, but my performance is lower than expected

Operating System

  • Windows 10

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.

  1. I created a new Katalon Studio project. I used version 8.2.5 on Mac os 12.2.1
  2. I created a new Test Case named “Test Cases/New Test Case”
  3. 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")
	}
}
  1. Manually I fold the 3 methods as follows
  2. At the line#3 I typed public
  3. 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…
Katalon-Studio---8

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

  1. first, fix the syntactical errors
  2. close the editor
  3. reopen the editor

@simos.sigma You don’t have to re-fold defs one by one manually.