How to map between manual steps to script mode line number in Katalon Studio
can you elaborate more?
I my humble opinion, you should not switch between the Manual mode and the Script mode of Test Case editor.
If you start using the Script mode, you should stay with it; you should never switch to the Manual mode.
Switching between Script mode and Manual mode causes many problems.
See the following post:
No way.
It seems you imagin that there is a simple, straight-forward “mapping” rule between the source code lines in the Manual mode and the lines in the Script mode.
No, that is not the case.
The system is far more complexed. See the following post of mine:
The keyword is “Abstract Syntax Tree Transformation”. See the following article for what AST Transformation is, which was written 15 years ago by Guillaume LaForge, the Groovy language mainterner:
What I do is build my scripts in Script mode and occasionally move to Manual mode to check my line numbering (I stop a TC around 300 lines). As @kazurayam mentioned though, DO NOT CHANGE anything in Manual mode if you have worked in Script mode, just get your line numbers by moving the slide bar, or the specific line number of what you want, and then move back to Script mode.
Let me show you an example how the system is complexed. I would quote an example from Katalon loses vital code switching to/from Manual View (was Katalon issue Javascript) - #3 by kazurayam
Here I have a Test Case script manually coded in the Script mode:
def js = """
console.log("Hello, world!");
"""
println js
I switched the Manual mode, and I altered the Test Case a bit in the Manual mode: I inserted a call to WebUI.acceptAlert()
. I switched back to the Script mode.
Then I found the following code in the Script mode.
def js = '\n console.log("Hello, world!");\n'
println(js)
WebUI.acceptAlert()
As you see, Katalon Studio mangled the original string literal quoted with a pair of triple " symbols into a completely different form of string literal.
In the original code, the string literal had 3 lines. But that stuff was transformed into 1 line of code.
This transformation by Katalon Studio involves the Groovy compiler and the Abstract Syntax Tree transformation technique.
I think, this transformation is complexed enough.