Improve Comments and Auto-format behaviour


#1

Hello,

I’d like to present the following four improvement suggestions to you that came up during our daily work with Katalon Studio. All off them are connected to comments and auto-formatting.

1. Creation of multiline comments for reports

We frequently use the generated PDF reports. In some cases, we add comments that extend the usual line with by far. Currently we need to put them in a single line that becomes really long. So I’d like to suggest to implement multi-line comments such as /* */ that are displayed at the report.

' A comment can get reeeeally long and extends the usual line with by far. I hope you see in this tiny example. But when you use longer descriptions, ....'

Probably the following syntax could be used

/'
 ' A comment can get reeeeally long
 ' But here we can put it in more than one line
 ' I guess you see.
 '/

We cannot use the usual java comment since they are not displayed at the report and due to the issue suggested in 2.

2. Improve auto formating

We really like the auto-formating function in test cases using Ctrl + Shift + F. The only problem is, that comment that do not start with a single quotation mark are getting replaced at the end of the test case. It would be good to avoid this behaviour and let the comments stay at their position. See the following two snippets that could come from any test case. A far as i figured out, this behaviour occurs only in test cases.

Before auto-format

if(2 > 3){
	callAMethod()
}else{
	callOtherMethod()
}

/**
 * Calculates sth
 */
int callAMethod(){
	// My Variable
	int i = 5
}

/*
 * Calculates sth else
 */
int callOtherMethod(){
	/*
	 * Longer comment inside callOtherMethod()
	 */
	int y = 7
}

if (2 > 3) {
    callAMethod()
} /**
 * Calculates sth
 */
// My Variable
/*
 * Calculates sth else
 */
/*
	 * Longer comment inside callOtherMethod()
	 */
else {
    callOtherMethod()
}

int callAMethod() {
    int i = 5
}

int callOtherMethod() {
    int y = 7
}

After auto-format

3. Auto format for imports

Another useful function is Organize Imports (Ctrl + Shift + O). Besides the removal of unused imports it also inserts an empty line between different types of imports. When running auto format afterwards, the line disappears. From my point of view it would good to keep it or even add it when running the auto format.

After running Organize Imports its fine

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

import org.openqa.selenium.By as By
import org.openqa.selenium.WebDriver as WebDriver
import org.openqa.selenium.WebElement as WebElement

import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

Running Auto format on the code causes

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import org.openqa.selenium.By as By
import org.openqa.selenium.WebDriver as WebDriver
import org.openqa.selenium.WebElement as WebElement
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

I know this is not a major feature, but at least nice to have.

4. Having the setting to run Auto format and Organize imports automatically when we save a file

At the end of the day it would be nice to have a setting so Auto format and Organize imports is done automatically when saving a file.

Kind Regards,

Paul


#2

Auto-Formatting = Having feature to DISABLE the auto-formatting will be significant improvement to the studio I have the same issues and it is extremely frustrating during test development + refactoring that the studio always automatically reformats, rearranges and messes up our script code
:confounded: