Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Groovy:setPropertyValue()_Groovy - Fatal编程技术网

Groovy:setPropertyValue()

Groovy:setPropertyValue(),groovy,Groovy,我需要在属性测试步骤中更新一个值。动态地,我在“abc”参数中获得值,而“line1”值需要在属性测试步骤的“abc”参数中更新 testRunner.testCase.getTestStepByName("Properties1").setPropertyValue(%s,"abc",line1) 这是一个错误消息 下面是错误消息 org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: S

我需要在属性测试步骤中更新一个值。动态地,我在“abc”参数中获得值,而“line1”值需要在属性测试步骤的“abc”参数中更新

testRunner.testCase.getTestStepByName("Properties1").setPropertyValue(%s,"abc",line1)
这是一个错误消息

下面是错误消息

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
我修正了你的问题-你可能需要花点时间来回答。您的错误消息被隐藏,因为它位于html括号内,而且都是一行,因此很难阅读

至于该错误,它是一个编译错误(
multiplecompilationerrorseception
)。这意味着代码本身无效

只要看看您的代码,我就会看到:

.setPropertyValue(%s,"abc",line1)
                  ^^
标记的值不是有效的Groovy代码。我不知道你想要什么,但它看起来像是从其他东西复制粘贴到这里的。你可能是说:

.setPropertyValue("abc", line1)
解决这个问题,您就可以编译代码了。

我解决了您的问题-您可能需要花点时间来解决这个问题。您的错误消息被隐藏,因为它位于html括号内,而且都是一行,因此很难阅读

至于该错误,它是一个编译错误(
multiplecompilationerrorseception
)。这意味着代码本身无效

只要看看您的代码,我就会看到:

.setPropertyValue(%s,"abc",line1)
                  ^^
标记的值不是有效的Groovy代码。我不知道你想要什么,但它看起来像是从其他东西复制粘贴到这里的。你可能是说:

.setPropertyValue("abc", line1)

修复此问题,您可能能够编译代码。

下面的代码行会有所帮助

testRunner.testCase.getTestStepByName("Properties Test Step Name").getProperty("Prop1").setValue("MyValue")
或设置不存在的属性

testRunner.testCase.testSteps["Properties Test Step Name"].setPropertyValue( "Prop1", "MyValue" )

我已经在我的代码中对此进行了测试,它可以正常工作。

下面的代码行会有所帮助

testRunner.testCase.getTestStepByName("Properties Test Step Name").getProperty("Prop1").setValue("MyValue")
或设置不存在的属性

testRunner.testCase.testSteps["Properties Test Step Name"].setPropertyValue( "Prop1", "MyValue" )

我已经在我的代码中对此进行了测试,它可以正常工作。

请在内容中添加错误消息its。请帮助请在内容中添加您的错误消息。请帮忙谢谢你的反馈。我明白这是错误的。请参阅我的qn,[我需要更新属性测试步骤中的值。动态地,我需要访问“abc”参数中的值,而“line1”值需要更新属性测试步骤中的“abc”参数中的值。]感谢您的反馈。我明白这是错误的。请参阅我的qn,[我需要在属性测试步骤中更新值。动态地,我需要访问“abc”参数中的值,而“line1”值需要在属性测试步骤中的“abc”参数中更新。]