Forum Discussion
Actually that external scripts contains all the common function that each test step uses. So rather loading it into each test step i want to load it only once in test suite level.
As mentioned above, just put your scripts in a directory (Note: Scripts should be placed in directories named after their containing package)., reference that directory, via the Groovy Library preference and you should be good to go, no need to "load" the scripts at all.
Have a read of the above documentation links, in particular the first one.
- Vidushi8 years agoOccasional Contributor
Thanks for guiding me, I have done as mentioned by using the script as library but it is not able to find methods like this:
public static Map<String,String> getAutoConfigDetails(String fileFullPath)
Any idea??
- Radford8 years agoSuper Contributor
Your script files must be valid classes, not just arbitrary scripts.
I usually just create "utility" classes, and make all the methods static when I want simple stand-alone scripts. This documentation page has an example of creating a class with a static method and calling it. Also take note of the section on packages and how that affects the directory structure.
The one thing that I do which isn't in that documentation page, is to put import statements in my Groovy scripts that call the library functions, thus for the example on the above page, I would add to my calling script:
import readyapi.demo.Callee
- Vidushi8 years agoOccasional Contributor
Thankyou so much for replying. I have one more doubt if I want to load two groovy scripts ,that are in the same directory, with the same procedure mentioned above then it is not able to load that. Can anyone tell how can i achieve this one?
Related Content
- 2 months ago
Recent Discussions
- 19 days ago