Debugging - Expression evaluation DOESN'T WORK

Hi,

I cannot evaluate expressions while debugging scripts.
I’m in the Debug view (as opposed to the Keyword view, both options are available from the default upper toolbar. See image below). Out of the 3 tabs - Variables, Breakpoints, and Expressions - I’m selecting the Expressions tab.
No matter what expression I try - be it a variable, a comparison expression or any other command I’ve been using, the result is the same - I’m getting "<error(s)_during_evaluation> (image below).
I’m currently checking Katalon Studio as our company’s Automation tool and having worked with various IDEs for long, I find the debugging module not very usable. Almost needless to mention, expression evaluation is a very crucial part of debugging, and using print statement in our scripts as a substitute for it is not really an option.

Bottom line - I know there is a debugging module, but the documentation around it is very very poor (the documentation and posts that exist now and show how to start debugging without almost any details doesn’t really count) and is a huge drawback, one that makes me think if Katalon is mature enough for our needs.

Any corrections or links to relevant documentation would be much appreciated.
Thanks!

Katalon expression evaluation fails.png

1 Like

Hello,
what are errors? please make screenshot with symbol > before expression clicked on, so we can see actual errors…
on 1st look you are missing ; on the end of expression, but can be more

It only works if your variable use ‘def’, example:

def var1 = “Your value”

Hi Andrej,

Thanks for your quick reply.
I’m getting the errors with or without semicolons. Actually, my whole (working) code doesn’t use semicolons to mark the ends of the lines. In Java they are needed but - not having experience in Groovy - I understand in Groovy they’re usually optional.
What else would you like to know about the errors? What I added in the screenshot is what I have valid variables and expression (they work when running them as a part of the script) with or without semicolons, for which I get always “<error(s)_during_evaluation>”.
Some examples of the expressions I’m using are:

  • findTestObject(‘Object Repository/MyScript/MyObj’).toString();

  • step3.findPropertyValue(“MyPropoerty”);

  • Various variables I use in my code

Please let me know if you need additional info or if there’s something I missing.

Thanks a lot!

Vinh Nguyen said:

It only works if your variable use ‘def’, example:

def var1 = “Your value”

Thanks Vinh,

These are expressions I use in my script successfully and I try evaluating them only in a point where the context contain them, i.e I have a breakpoint on a line that uses the expression after having created this variable, and only then I try to evaluate. Even if I do use def in an Expressions tab entry, a different line won’t recognize it, right?

please open error messages you are receiving on evaluation

so we can see actual errors

image.png

Andrej Podhajský said:

please open error messages you are receiving on evaluation

so we can see actual errors

Ok, I think I got it.
Didn’t know that I can open and see the message, that was helpful. Plus Vinh’s comment that I need to use def for the variable to be recognized now I do see results.
Can all valid expressions be evaluated or is there a difference between expressions on the Expressions tab and expressions in the script?
And in general, where can I find documentation about debugging in Katalon where I could find what you guys are saying here for instance? I didn’t find much.

Thanks a lot Andrej and Vinh! Much appreciated.

I’m also encountering the same issues. Expression evaluation rarely works.