0

I am working with groovy and want to load a groovy script in another groovy script. Is there any way that i can load this script from any location in my system?

Can someone give an example.

jrbedard
  • 3,662
  • 5
  • 30
  • 34
  • 1
    Possible duplicate of [Including a groovy script in another groovy](http://stackoverflow.com/questions/9136328/including-a-groovy-script-in-another-groovy) – mdabrowski Jan 10 '17 at 11:10
  • Possible duplicate of [Load script from groovy script](https://stackoverflow.com/questions/9004303/load-script-from-groovy-script) – haridsv Sep 16 '18 at 05:35

1 Answers1

0

You can do it using Script.evaluate() function like:

evaluate(new File("test.groovy"))

Demo:

Groovy evaluate function

There is also __groovy() function available since JMeter 3.1, you may find this useful as well.

Dmitri T
  • 159,985
  • 5
  • 83
  • 133