header
header
Main Menu
Home
Eviware Store
Downloads
Products
News
Forum
Eviware Blog
Search
FAQs
Customer Area
Support
Documentation
Tutorials
CookBook
Downloads
Forum
Login Form
Welcome, Guest. Please login or register.
November 22, 2008, 02:39:38 am
Username: Password:
Login with username, password and session length

Forgot your password?
 
Create Groovy library?
Welcome, Guest. Please login or register.
November 22, 2008, 02:39:38 am
Home Help Search Login Register
News: The Forums are up! Welcome to eviware.

+  Eviware Forum
|-+  soapUI
| |-+  soapUI
| | |-+  Create Groovy library?
« previous next »
Pages: [1] Print
Author Topic: Create Groovy library?  (Read 799 times)
zxsoap
Newbie
*
Posts: 19


« on: June 17, 2008, 11:08:47 pm »

Hi All,

I want to create a Groovy library. Anyone tried it yet? Please, let me know.  I'm able to create a Java class, not Groogy scripts?

Thanks,
Tim
Logged
zxsoap
Newbie
*
Posts: 19


« Reply #1 on: June 20, 2008, 03:54:03 pm »

All,

Here's my groovy scrip look like and I want to share it by all my testcases. Is it possible to create a library to hold it. I want to use it like a function library. I tried to create a java class but got the issue with import eviware....

groovyUtils = new com.eviware.soapui.support.GroovyUtils(context )
holder = groovyUtils.getXmlHolder ("searchTempT#Response")
def nname= holder.getNodeValues ("//name") 

for (n in nname)
{
 println n
}

Thanks,
zx
Logged
omatzura
Administrator
Hero Member
*****
Posts: 1,425


« Reply #2 on: June 23, 2008, 11:39:47 pm »

Hi!

soapUI Pro has the functionality required for this: http://www.soapui.org/userguide/scripting.html#Groovy_Script_Library.

If you are not using soapUI Pro you will need to compile your scripts into a standard java library (ie .jar file) and add that file to the classpath by putting it in the bin\ext folder..

regards!

/Ole
eviware.com
Logged
zxsoap
Newbie
*
Posts: 19


« Reply #3 on: July 01, 2008, 03:50:13 pm »

Hi Ole,

Thank for you helps. Yes, I want to build groovy library class ( I used 2.0.2 Pro). I have an issue how to use "testRunner.testCase.name". I did include "import com.eviware.soapui.model.testsuite.TestRunner". But it could get a test case name (null value) at run time.

Here's what I want to do. I want to build a class which's going to get the test case name and write to text file at run time. I'm using  "testRunner.testCase.name". But have issue with it. Here's the I tried to build (not 100% complete yet)



package soapui.Report

import com.eviware.soapui.SoapUI
import com.eviware.soapui.model.testsuite.TestRunner

public class Rwrite
{
   
   
public void  fw ()
   {
     TestRunner testRunner
 
    println "TestCase: " + testRunner.testCase.name
   
}

Did I do something wrong? why testRunner.testCase.name's always return  NULL.

Thanks,
zx
Logged
omatzura
Administrator
Hero Member
*****
Posts: 1,425


« Reply #4 on: July 01, 2008, 11:12:26 pm »

Hi!

you'll need to pass the testRunner as an argument to your fw method.. ie

Code:
..
public void fw( Object testRunner )
{
...
}

...

hope this helps!

regards,

/Ole
eviware.com
Logged
zxsoap
Newbie
*
Posts: 19


« Reply #5 on: July 07, 2008, 09:22:07 pm »

Hi Ole,

It's still return Null as I used the following code.

public class Rwrite
{
   
   
public void  fw (TestRunner testRunner)
   {
       
    println "TestCase: " + testRunner.testCase.name
   }

}

Thanks,
zx
Logged
omatzura
Administrator
Hero Member
*****
Posts: 1,425


« Reply #6 on: July 08, 2008, 08:55:17 am »

Hi!

how are you using the Rwrite class from your scripts? Can you show the code?

regards!

/Ole
eviware.com
Logged
zxsoap
Newbie
*
Posts: 19


« Reply #7 on: July 08, 2008, 05:32:40 pm »

Ole,

Here's my code used under Grooyy script. (If I remove the "testRunner.testCase.name" under println. It's working ok.)


def wReports = new soapui.Report.Rwrite()
wReports.fw ()

Here's class with .groovy

package soapui.Report
public class Rwrite
{
   import com.eviware.soapui.model.testsuite.TestRunner
   
public void  fw (TestRunner testRunner)
   {
       
    println "TestCase: " + testRunner.testCase.name
   }

}


Thanks,
zx


Logged
omatzura
Administrator
Hero Member
*****
Posts: 1,425


« Reply #8 on: July 08, 2008, 11:24:42 pm »

Hi,

I think you need to pass the testRunner as an argument.. ie

def wReports = new soapui.Report.Rwrite()
wReports.fw ( testRunner )

regards!

/Ole
eviware.com
Logged
zxsoap
Newbie
*
Posts: 19


« Reply #9 on: July 09, 2008, 02:55:27 pm »

It worked...thank alot.
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
header header
header
header