Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9241431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:22:16+00:00 2026-06-18T08:22:16+00:00

How can I include groovy script from an external file? I was tried to

  • 0

How can I include groovy script from an external file?
enter image description here

I was tried to use:

def script = new GroovyScriptEngine('d:/soapui/payment.v2').with { 
    loadScriptByName( 'proxy.groovy' ) 
} 
this.metaClass.mixin script

But I get:

enter image description here

Update

Is there exists some possibility to pack my methods into jar or something like this, and use them from Script TextArea?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T08:22:17+00:00Added an answer on June 18, 2026 at 8:22 am

    The simplest way is to use Groovy Test Step within SOAPUI to run the external script using the GroovyScriptEngine. I use GroovyUtils to find the Project’s path so that the entire project can be kept in one place to aid source control, editing etc.

    import groovy.lang.Binding
    import groovy.util.GroovyScriptEngine
    
    def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
    
    // location of script file is relative to SOAPUI project file.
    String scriptPath = groovyUtils.projectPath + "/groovy/"
    
    // Create Groovy Script Engine to run the script.
    GroovyScriptEngine gse = new GroovyScriptEngine(scriptPath) 
    
    // Load the Groovy Script file 
    externalScript = gse.loadScriptByName("Utility.groovy")  
    
    // Create a runtime instance of script
    instance = externalScript.newInstance()
    
    // Sanity check 
    assert instance!= null
    
    // run the foo method in the external script
    instance.foo()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In html you can include a file (such as a script or styletsheet) using
I know I can include Python code from a common file using import MyModuleName
I can include this file directly now without tr1 in VS 2010 but can't
I would like to know how i can include files from multiple locations in
I can include 1 js file with Ti.include like: Ti.include(login.js) But, i am having
How I can include native .dll file in root of JAR using Maven?
In windows you can include the windows.h header file when trying to parse bmp
I know I can include other files using PHP <?php include(file.php); ?> Now my
How can include .asp file inside of html file and have it proccessed besides
have a small javscript that users can include into their sites like so: <script

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.