【问题标题】:Ambiguous method overloading for method com.eviware.soapui.support.XmlHolder#com.eviware.soapui.support.XmlHolder 方法的模棱两可的方法重载#
【发布时间】:2019-06-06 22:12:38
【问题描述】:

当我在 SoapUI 5.5.0 中尝试这个 groovy 脚本时,我得到了这个错误:

groovy.lang.GroovyRuntimeException:方法 com.eviware.soapui.support.XmlHolder# 的​​方法重载不明确。由于原型之间的重叠,无法解析为 [null] 调用哪个方法:[interface org.apache.xmlbeans.XmlObject] [interface org.w3c.dom.Node] 第 19 行错误

import com.eviware.soapui.support.XmlHolder

log.info "welcome to canada"

def name=context.expand ('${#TestCase#name}')

log.info context.expand ('${#TestSuite#place}')
//log.info context.expand('${#AddAutomation#id}')//its not going to grab values or properties of other testcases 
def id=testRunner.testCase.testSuite.testCases["AddAutomation"].getPropertyValue("id")

def age=testRunner.testCase.testSuite.setPropertyValue("age","23")
def department=testRunner.testCase.testSuite.testCases["AddAutomation"].setPropertyValue("department","CSE")

def request=log.info testRunner.testCase.testSuite.testCases["AddAutomation"].testSteps["Add"].getPropertyValue("Request")

def xmlnew=new XmlHolder(request)
xmlnew.setNodeValue("\\typ:addEmployee\typ:name","name")

xmlnew.setNodeValue("\\typ:addEmployee\typ:id","id")

xmlnew.setNodeValue("\\typ:addEmployee\typ:age","age")
xmlnew.setNodevalue("\\typ:addEmployee\typ:department","department")

【问题讨论】:

  • 我猜,request 是空的 - 如果这是有意的,那么你必须投射请求

标签: groovy soapui


【解决方案1】:

您的脚本有:

...
def request=log.info testRunner.testCase.testSuite.testCases["AddAutomation"].testSteps["Add"].getPropertyValue("Request")

def xmlnew=new XmlHolder(request)
...

log.info 行将始终返回null,因此下一行错误。你真正想要的很可能是:

...
def request=testRunner.testCase.testSuite.testCases["AddAutomation"].testSteps["Add"].getPropertyValue("Request")
log.info request
def xmlnew=new XmlHolder(request)
...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-03-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多