Can't load groovy script from script library
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2009
05:31 PM
08-04-2009
05:31 PM
Can't load groovy script from script library
Hi,
I am trying to use the script library feature of SoapUI Pro in version 2.5.1 on Windows. I just can't get it to work. When calling a static method on a class or instantiating a class, I receive a "unable to resolve class" error. When I change the groovy file, SoapUI is reporting and update, "MyTest.groovy is new or has changed, reloading...
But using anything in the file fails.
=== MyTest.groovy
package test
public class MyTest
{
static def test =
{
log.info("Hello Test")
}
}
===
// Groovy script in Groovy Test Step
test.MyTest.test()
Results in: unable to resolve class test.MyTest @ line 1
I am trying to use the script library feature of SoapUI Pro in version 2.5.1 on Windows. I just can't get it to work. When calling a static method on a class or instantiating a class, I receive a "unable to resolve class" error. When I change the groovy file, SoapUI is reporting and update, "MyTest.groovy is new or has changed, reloading...
But using anything in the file fails.
=== MyTest.groovy
package test
public class MyTest
{
static def test =
{
log.info("Hello Test")
}
}
===
// Groovy script in Groovy Test Step
test.MyTest.test()
Results in: unable to resolve class test.MyTest @ line 1
3 REPLIES 3
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2009
01:07 AM
08-05-2009
01:07 AM
Hi!
is the file in a folder named after its package? (ie "test")
regards!
/Ole
eviware.com
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
is the file in a folder named after its package? (ie "test")
regards!
/Ole
eviware.com
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2009
05:28 PM
08-05-2009
05:28 PM
::) Yes, that works, thanks.
Is it possible to have a collection of groovy functions/closures in a file without a name space (default package name)?
So for example have a file called lib.groovy in the scripts directory with something useful like:
def logInfo = {t -> log.info(t) }
def myFunc() { "This is my function" }
Is it possible to have a collection of groovy functions/closures in a file without a name space (default package name)?
So for example have a file called lib.groovy in the scripts directory with something useful like:
def logInfo = {t -> log.info(t) }
def myFunc() { "This is my function" }
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2009
07:06 AM
08-06-2009
07:06 AM
Hi Mark,
script files must be valid classes, not just arbitrary scripts.
So, you can create groovy class with static methods or closures and use them in your script.
And of course if you use default package name put your groovy file into bin/scripts folder.
regards
Nebojsa
eviware.com
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
script files must be valid classes, not just arbitrary scripts.
So, you can create groovy class with static methods or closures and use them in your script.
And of course if you use default package name put your groovy file into bin/scripts folder.
regards
Nebojsa
eviware.com
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
