Reputation: 799
I need to update a value in the property test step. Dynamically I am getting value in 'abc' parameter and 'line1' value need to update in 'abc' parameter in Properties test step.
testRunner.testCase.getTestStepByName("Properties1").setPropertyValue(%s,"abc",line1)
This is giving an error message.
following is the Error msg,
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script99.groovy: 19: expecting EOF, found '(' @ line 19, column 70. Properties1").setPropertyValue(%s,"abc", ^
org.codehaus.groovy.syntax.SyntaxException: expecting EOF, found '(' @ line 19, column 70. at
org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:139) at
org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:107) at
org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:236) at
org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:163) at
org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:839) at
org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:544) at
org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:520) at
org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:497) at
groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:306) at
groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:287) at
groovy.lang.GroovyShell.parseClass(GroovyShell.java:731) at
groovy.lang.GroovyShell.parse(GroovyShell.java:743) at
groovy.lang.GroovyShell.parse(GroovyShell.java:770) at
groovy.lang.GroovyShell.parse(GroovyShell.java:761) at
com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.compile(SoapUIGroovyScriptEngine.java:148) at
com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:93) at
com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:148) at
com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:274) 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: Script99.groovy:19:70: expecting EOF, found '(' at
groovyjarjarantlr.Parser.match(Parser.java:211) at
org.codehaus.groovy.antlr.parser.GroovyRecognizer.compilationUnit(GroovyRecognizer.java:780) at
org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:130) ... 20 more 1 error
Upvotes: 1
Views: 10518
Reputation: 436
The below line of code would help,
testRunner.testCase.getTestStepByName("Properties Test Step Name").getProperty("Prop1").setValue("MyValue")
or to set up property if it does not exist
testRunner.testCase.testSteps["Properties Test Step Name"].setPropertyValue( "Prop1", "MyValue" )
I've tested this in my code, it will work fine.
Upvotes: 2
Reputation: 39560
I fixed your question - you may want take the time to understand how to format questions. Your error message was being hidden because it was inside html brackets, and also it was all one line, making it hard to read.
As for the error, it is a compilation error (MultipleCompilationErrorsException
). This means that the code itself is invalid.
Simply looking at your code, I see this:
.setPropertyValue(%s,"abc",line1)
^^
The marked value is not valid Groovy code. I don't know what you were going for, but it looks like it was copied and pasted here from something else. You probably meant:
.setPropertyValue("abc", line1)
Fix this, and you might be able to get your code to compile.
Upvotes: 2