Ask a Question

Previously working test no longer works...

SOLVED
LostInSpace
New Contributor

Previously working test no longer works...

Hi!

 

I have been asked to run a ReadyAPI test that was last run about a year ago.

 

I am now getting this groovy error when I try to run it:

 

 

startup failed:
Script3.groovy: 1: Unexpected input: '\' @ line 1, column 86.
   eDateFormat; use(TimeCategory)\u007B new
                                 ^
org.codehaus.groovy.syntax.SyntaxException: Unexpected input: '\' @ line 1, column 86.
	at org.apache.groovy.parser.antlr4.AstBuilder$1.syntaxError(AstBuilder.java:4597)
	at groovyjarjarantlr4.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:44)
	at groovyjarjarantlr4.v4.runtime.Parser.notifyErrorListeners(Parser.java:543)
	at groovyjarjarantlr4.v4.runtime.DefaultErrorStrategy.notifyErrorListeners(DefaultErrorStrategy.java:154)
	at org.apache.groovy.parser.antlr4.internal.DescriptiveErrorStrategy.reportInputMismatch(DescriptiveErrorStrategy.java:103)
	at org.apache.groovy.parser.antlr4.internal.DescriptiveErrorStrategy.recover(DescriptiveErrorStrategy.java:55)
	at org.apache.groovy.parser.antlr4.internal.DescriptiveErrorStrategy.recoverInline(DescriptiveErrorStrategy.java:68)
	at groovyjarjarantlr4.v4.runtime.Parser.match(Parser.java:213)
	at org.apache.groovy.parser.antlr4.GroovyParser.compilationUnit(GroovyParser.java:362)
	at org.apache.groovy.parser.antlr4.AstBuilder.buildCST(AstBuilder.java:405)
	at org.apache.groovy.parser.antlr4.AstBuilder.buildCST(AstBuilder.java:384)
	at org.apache.groovy.parser.antlr4.AstBuilder.buildAST(AstBuilder.java:424)
	at org.apache.groovy.parser.antlr4.Antlr4ParserPlugin.buildAST(Antlr4ParserPlugin.java:58)
	at org.codehaus.groovy.control.SourceUnit.buildAST(SourceUnit.java:257)
	at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
	at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
	at org.codehaus.groovy.control.CompilationUnit.buildASTs(CompilationUnit.java:666)
	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:632)
	at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:389)
	at groovy.lang.GroovyClassLoader.lambda$parseClass$3(GroovyClassLoader.java:332)
	at org.codehaus.groovy.runtime.memoize.StampedCommonCache.compute(StampedCommonCache.java:163)
	at org.codehaus.groovy.runtime.memoize.StampedCommonCache.getAndPut(StampedCommonCache.java:154)
	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:330)
	at groovy.lang.GroovyShell.parseClass(GroovyShell.java:526)
	at groovy.lang.GroovyShell.parse(GroovyShell.java:538)
	at groovy.lang.GroovyShell.parse(GroovyShell.java:570)
	at groovy.lang.GroovyShell.parse(GroovyShell.java:565)
	at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.recompileWithNewName(SoapUIGroovyScriptEngine.java:151)
	at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.compile(SoapUIGroovyScriptEngine.java:142)
	at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:91)
	at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SoapUIProGroovyScriptEngineFactory.java:83)
	at com.eviware.soapui.model.propertyexpansion.resolvers.EvalPropertyResolver.doEval(EvalPropertyResolver.java:161)
	at com.eviware.soapui.model.propertyexpansion.resolvers.EvalPropertyResolver.resolveProperty(EvalPropertyResolver.java:149)
	at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:213)
	at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:221)
	at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:156)
	at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:152)
	at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expandProperties(PropertyExpander.java:135)
	at com.eviware.soapui.impl.wsdl.submit.filters.PropertyExpansionRequestFilter.filterAbstractHttpRequest(PropertyExpansionRequestFilter.java:48)
	at com.eviware.soapui.impl.wsdl.submit.filters.AbstractRequestFilter.filterRequest(AbstractRequestFilter.java:34)
	at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.filterRequest(HttpClientRequestTransport.java:420)
	at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.sendRequest(HttpClientRequestTransport.java:196)
	at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:130)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
	at java.base/java.lang.Thread.run(Thread.java:832)

1 error

 

 

I get this error when it tries to evaluate this:

 

 

${=import groovy.time.TimeCategory; import java.text.SimpleDateFormat; use(TimeCategory)\u007B new SimpleDateFormat("yyyy/MM/dd").format(new Date("${#Project#birthDate0an}") - 58.year)\u007D}

 

 

The code in question is put in a custom project property and birthDate0an exists and it is correctly initialized.

 

Now as far as I can see the parsing of the groovy code fails at the "\u007B" (right curly bracket code in Unicode).

 

Now I tried to replace "\u007B" by "{" and "\u007D" by "}" and it did not work so it looks like the inner curly brackets must be escaped.

 

The only thing I can think could have changed between now and 1 year ago when that test was last run is the version of ReadyAPI.

 

What can I do to make this test work again?

 

Thank you and have a nice day!

 

Nick

5 REPLIES 5
PrathapR
Frequent Contributor

Hey @LostInSpace 

 

Could you please provide more details?, like what is expected output format, and what format you are passing in 

${#Project#birthDate0an}
richie
Community Hero

Hey @LostInSpace,

I suspect youve stumbled across a change that occurred within the last year. A lot of people had this.... i believe a date handling method in the jre was deprecated in the newer version of java or something similar


Im typing on my phone right now,but when i get back to my laptop i'll post what i started using instead.

Ta

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
sonya_m
SmartBear Alumni (Retired)

Thank you @richie ! That would be awesome if you could share your approach here!


Sonya Mihaljova
Community and Education Specialist

nmrao
Community Hero

There are changes in data time libraries from Jdk 8.

Try something like below:

 

{
	"date": "${= import java.time.LocalDate; import java.time.format.DateTimeFormatter; LocalDate.from(LocalDate.parse('2021/03/01', DateTimeFormatter.ofPattern('yyyy/MM/dd'))).minusYears(58)}"
}


Regards,
Rao.
sonya_m
SmartBear Alumni (Retired)

Thanks Rao!

@LostInSpace did you give the suggested script a go?


Sonya Mihaljova
Community and Education Specialist

cancel
Showing results for 
Search instead for 
Did you mean: