In Katalon Studio, when using triple double quotes to define a multi-line string in Groovy, the triple double quotes are automatically replaced by a single double quote, which causes an issue when trying to keep the code as originally written.
The problem occurs because Katalon Studio’s Groovy parser interprets triple double quotes as a string literal and converts them to single double quotes, which alters the intended format of the JavaScript code.
Is there a way to prevent Katalon Studio from automatically converting the triple double quotes to single double quotes and keep the code exactly as written?
Alternatively, how can I work around this issue in Katalon Studio to maintain the original format of the JavaScript code defined within the triple double quotes?
Example :
my code for example like this :
def js = “”"
//code javascript 1
//code javascript 2
} “”"
the issue katalon studio do :
def js = "
//code javascript 1
//code javascript 2
} "
There is no way to tell Katalon Studio to respect the your original code format.
The Manual mode serializes the whole of Test Case code in a code format which the Manual mode is designed to follow. Their code format is unique and is most probably different from the code format you like. The Manual mode does not know your preference for code format.
As long as you don’t switch the Test Case editor from the Script mode to the Manual mode, you won’t be bothered by this symptom. So, don’t do it.
This is just one of many issues caused by switching between the views. The bug has always been there. My guess is, it’s not easy to recover from the switch TO manual and then BACK to Script (in manual view, code needs to be parsed and “conditioned” for the view template).
In which case, at the very least, a WARNING should popup:
This script contains formatted script code which may not be compatible with Manual View and will need to be removed. Do you wish to continue? (Choose CANCEL to keep your original code in Script View)
Thanks, but sometimes it’s easier to add manual steps, and this issue should ideally be handled by Katalon itself. It’s not feasible to completely avoid using the manual view, as there are certain scenarios where using manual view is faster.
Well, I somehow agree with … but.
This feature (manual view) it is mostly for new users with almost zero coding experience.
Looks like you are a bit more experienced, since you are already at the level when you write some custom code … but a bit lazy (like me).
So, you should be already familiar with typing, e.g WS. and use the intellicence provided by the eclipse engine. Using Manual View from time to time will only confuse you.
On the other side, yeah, this bug is valid and it is there since centuries.
It was reported many times in many ways.
Switching from one view to the other should not alter the existing code.
But I doubt it is an easy fix for it.
Mhm…
well, i propose another option.
Since the katalon ‘engine’ detects this somehow and do some action, instead of rising a warning it should notify the user ‘cannot parse this code block properly’ and give the user the choice between keeping the code block or re-format
Neither I, but let’s see if the development team pick-up the challenge.
Impossible is nothing!
I have some ideas how this can be achieved but let them ask, or do a brainstorm
I personally do not mind this issue much because I never use the Manual mode.
I always import many external libraries other than com.kms.katalon.core.*. The Manual mode is not designed to present those “non Katalon-native” code properly. Let me show you an example how my sample test case is displayed in Manual mode.
A long sequence of Binary Statement and Method Call Statement which intentionally hides the data type declarations of variables (String, float, BufferedImage). This presentation make me very frustrated. I would say that Manual mode with non Katalon-native factors is ugly.
The same test case in Script mode is presented like this:
To be totally free, simple dont use katalon.
So i don’t see your point here.
We help somehow the development team with how to improve it, or we create a library with workarounds?