Debugging scripts loaded with GroovyShell (in eclipse)
Posted
by
MSh
on Stack Overflow
See other posts from Stack Overflow
or by MSh
Published on 2011-01-28T21:26:59Z
Indexed on
2011/01/29
7:25 UTC
Read the original article
Hit count: 191
I am working with eclipse and groovy plug in. I am building a test harness to debug and test groovy scripts. The scripts are really simple but long, most of them just if/else/return. I figured out that I can call them using GroovyShell and Bindings to pass in the values.
The problem is that, while I can call the script and get the results just fine, I CAN NOT step in there with the debugger. Breakpoints in those scripts are not active.
Is there a way to debug the scripts? Maybe I should use something other than GroovyShell? I really don't want to modify the scripts by wrapping them into functions, and then calling those functions from my test classes.
That's how I am using Binding and GroovyShell:
def binding = new Binding();
binding.lineList = [list1];
binding.count = 5;
def shell = new GroovyShell(binding);
def result = shell.evaluate(new File("src/Rules/checkLimit.groovy"));
© Stack Overflow or respective owner