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, 10:37:14 am
Username: Password:
Login with username, password and session length

Forgot your password?
 
Getting error for the Groovy Script
Welcome, Guest. Please login or register.
November 22, 2008, 10:37:14 am
Home Help Search Login Register
News: The Forums are up! Welcome to eviware.

+  Eviware Forum
|-+  soapUI
| |-+  soapUI
| | |-+  Getting error for the Groovy Script
« previous next »
Pages: [1] Print
Author Topic: Getting error for the Groovy Script  (Read 485 times)
ahsu
Newbie
*
Posts: 10


« on: April 22, 2008, 02:19:13 pm »

Groovy script i tried to run is

def values = context.getProperty( "values" )
def index = context.getProperty( "index" )

def str = values[index]
def ix = str.indexOf( "," )

def props = testRunner.testCase.getTestStepByName( "Properties" )
def resultCount = props.getPropertyValue( "ResultCount" )
def count = str.substring( ix+1 )
def year = props.getPropertyValue( "year" )

if( count > resultCount )
{
   throw new Exception( "not enough hits for year [" + year +
                        "], expected " + count + ", got " + resultCount )
}
else
{
   log.info( "got " + resultCount + " hits for [" + year + "], required " + count )
   if( ++index < values.size() )
   {
      context.setProperty( "index", index )
      testRunner.gotoStepByName( "Init Run" )
   }
   else
   {
      log.info ( "Finished TestCase, tested " + values.size() + " values" )
   }
}



and i am getting the following error




org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Script6.groovy: 1: unexpected token: @ line 1, column 1.org.codehaus.groovy.syntax.SyntaxException: unexpected token: @ line 1, column 1. at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:83) at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:239) at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:143) at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:772) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:438) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:271) at groovy.lang.GroovyShell.parseClass(GroovyShell.java:488) at groovy.lang.GroovyShell.parse(GroovyShell.java:500) at groovy.lang.GroovyShell.parse(GroovyShell.java:480) at groovy.lang.GroovyShell.parse(GroovyShell.java:539) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.compile(SoapUIGroovyScriptEngine.java:87) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:58) at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SourceFile:51) at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:140) at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.run(WsdlTestCaseRunner.java:185) at com.eviware.soapui.impl.wsdl.loadtest.WsdlLoadTestRunner$TestCaseRunner.run(WsdlLoadTestRunner.java:401) at java.lang.Thread.run(Unknown Source) Caused by: Script6.groovy:1:1: unexpected token: at org.codehaus.groovy.antlr.parser.GroovyRecognizer.compilationUnit(GroovyRecognizer.java:484) at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:74) ... 16 more 1 error startup failed, Script6.groovy: 1: unexpected token: @ line 1, column 1.org.codehaus.groovy.syntax.SyntaxException: unexpected token: @ line 1, column 1. at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:83) at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:239) at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:143) at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:772) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:438) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:271) at groovy.lang.GroovyShell.parseClass(GroovyShell.java:488) at groovy.lang.GroovyShell.parse(GroovyShell.java:500) at groovy.lang.GroovyShell.parse(GroovyShell.java:480) at groovy.lang.GroovyShell.parse(GroovyShell.java:539) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.compile(SoapUIGroovyScriptEngine.java:87) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:58) at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SourceFile:51) at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:140) at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.run(WsdlTestCaseRunner.java:185) at com.eviware.soapui.impl.wsdl.loadtest.WsdlLoadTestRunner$TestCaseRunner.run(WsdlLoadTestRunner.java:401) at java.lang.Thread.run(Unknown Source) Caused by: Script6.groovy:1:1: unexpected token: at org.codehaus.groovy.antlr.parser.GroovyRecognizer.compilationUnit(GroovyRecognizer.java:484) at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:74) ... 16 more 1 error


and i am not seeing any logs in the groovy log. Huh
Please, help me in this to resolve ASAP.


Thanks in advance for your response
Logged
omatzura
Administrator
Hero Member
*****
Posts: 1,425


« Reply #1 on: April 22, 2008, 03:01:11 pm »

Hi,

hmm.. this compiles ok for me.. what is your system locale? If you copy-pasted this, try pasting to notepad first to get rid of any "unusual" characters!?

regards,

/Ole
eviware.com
Logged
ahsu
Newbie
*
Posts: 10


« Reply #2 on: April 22, 2008, 03:20:53 pm »

Hi Ole,

Thanks for your reply.

but still i am facing the same error.
I am attaching the script and the error screen shot .

And i am unable to see any logs in the groovy log.

Please , tell me where i am missing exactly.

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


« Reply #3 on: April 22, 2008, 03:26:14 pm »

Hi,

can you double-click the error entry in the LoadTest log and post the detailed error information?

What happens if you run the TestCase from the TestCase editor.. same error?

regards,

/Ole
eviware.com
Logged
ahsu
Newbie
*
Posts: 10


« Reply #4 on: April 22, 2008, 03:34:14 pm »

I am getting the same error in the test case also.

Below is the test case log.

Test started at 2008-04-22 20:00:50.903
Step 1 [GetData] OK: took 7 ms
Step 2 [Properties] OK: took 0 ms
Step 3 [Init] OK: took 0 ms
Step 4 [Set Year Args] OK: took 16 ms
 -> Performed transfer [year]
Step 5 [GetGoodFridayRequest] OK: took 620 ms
Step 6 [Get Result] OK: took 0 ms
 -> Performed transfer [year]
Step 7 [Validate and Loop] FAILED: took 0 ms
 -> startup failed, Script3.groovy: 1: unexpected token: < @ line 1, column 1.org.codehaus.groovy.syntax.SyntaxException: unexpected token: < @ line 1, column 1.
   at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:83)
   at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:239)
   at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:143)
   at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:772)
   at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:438)
   at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:271)
   at groovy.lang.GroovyShell.parseClass(GroovyShell.java:488)
   at groovy.lang.GroovyShell.parse(GroovyShell.java:500)
   at groovy.lang.GroovyShell.parse(GroovyShell.java:480)
   at groovy.lang.GroovyShell.parse(GroovyShell.java:539)
   at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.compile(SoapUIGroovyScriptEngine.java:87)
   at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:58)
   at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SourceFile:51)
   at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:140)
   at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.run(WsdlTestCaseRunner.java:185)
   at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
   at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
   at java.util.concurrent.FutureTask.run(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Caused by: Script3.groovy:1:1: unexpected token: <
   at org.codehaus.groovy.antlr.parser.GroovyRecognizer.compilationUnit(GroovyRecognizer.java:484)
   at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:74)
   ... 20 more

1 error

TestCase finished with status [FINISHED], time taken = 643


Please find the attachment for the error.
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