Soapui 免费版可以在输出之间断言吗?

发布于 2024-07-16 10:00:33 字数 58 浏览 6 评论 0原文

Soapui 免费版可以在两个请求的输出之间断言吗? 我想检查一个输出的值是否等于另一个输出的值。

Can Soapui free edition assert between outputs from two requests?
I want to check if a value from a output is equal to value from another output.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

弱骨蛰伏 2024-07-23 10:00:33

是的你可以! :-)
这是一个在我的soapUI v2.5.2 中运行的 Groovy 脚本(它是专业版,但也可以在免费版本中运行):

def r1 = context.testCase.testSteps["Request #1"].properties["Response"]
def response1 = r1["value"]
def r2 = context.testCase.testSteps["Request #2"].properties["Response"]
def response2 = r2["value"]

log.info "Request #1 response: $response1"
log.info "Request #2 response: $response2"

assert response1 == response2

我希望这也适用于您。

干杯!
尚齐拉

Yes you can! :-)
Here's a Groovy script that works in my soapUI v2.5.2 (it's pro but this works in free version as well):

def r1 = context.testCase.testSteps["Request #1"].properties["Response"]
def response1 = r1["value"]
def r2 = context.testCase.testSteps["Request #2"].properties["Response"]
def response2 = r2["value"]

log.info "Request #1 response: $response1"
log.info "Request #2 response: $response2"

assert response1 == response2

I hope this works for you too.

Cheers!
Shonzilla

旧街凉风 2024-07-23 10:00:33

另一个有效的:

def myContext1 = new com.eviware.soapui.support.GroovyUtils( context )
holderOpConfirmation = myContext1.getXmlHolder ("opConfirmation3 - Request 2#Response")

holderOpConfirmation.namespaces["bilhete"] = "http://bilhete.ic.cp.fujitsu"
def ticketNo1 = holderOpConfirmation[ "//bilhete:ticketNo//bilhete:number" ]

log.info "ticketNo1: $ticketNo1"

//Segundo Bilhete
def myContext2 = new com.eviware.soapui.support.GroovyUtils( context )
holderGetNullifiedTickets = myContext2.getXmlHolder ("getNullifiedTickets - Request 1#Response")

holderGetNullifiedTickets.namespaces["bilhete"] = "http://bilhete.ic.cp.fujitsu"
def ticketNo2 = holderGetNullifiedTickets[ "//bilhete:getNullifiedTicketsReturn" ]

log.info "Numero bilhete 2: $ticketNo2"

if (!ticketNo2.contains(ticketNo1)) {
 com.eviware.soapui.support.UISupport.showInfoMessage(
    "O bilhete " + ticketNo1 + " nao se encontra entre os bilhetes anulados manualmente.\n" +
    "Por favor verifique a data do relatorio nas propriedades do teste");
}

// Garantir que a data de "getNullifiedTickets - Request 1" é um dia anterior à data da volta do askPlaces original
assert ticketNo2.contains(ticketNo1)

Another that worked:

def myContext1 = new com.eviware.soapui.support.GroovyUtils( context )
holderOpConfirmation = myContext1.getXmlHolder ("opConfirmation3 - Request 2#Response")

holderOpConfirmation.namespaces["bilhete"] = "http://bilhete.ic.cp.fujitsu"
def ticketNo1 = holderOpConfirmation[ "//bilhete:ticketNo//bilhete:number" ]

log.info "ticketNo1: $ticketNo1"

//Segundo Bilhete
def myContext2 = new com.eviware.soapui.support.GroovyUtils( context )
holderGetNullifiedTickets = myContext2.getXmlHolder ("getNullifiedTickets - Request 1#Response")

holderGetNullifiedTickets.namespaces["bilhete"] = "http://bilhete.ic.cp.fujitsu"
def ticketNo2 = holderGetNullifiedTickets[ "//bilhete:getNullifiedTicketsReturn" ]

log.info "Numero bilhete 2: $ticketNo2"

if (!ticketNo2.contains(ticketNo1)) {
 com.eviware.soapui.support.UISupport.showInfoMessage(
    "O bilhete " + ticketNo1 + " nao se encontra entre os bilhetes anulados manualmente.\n" +
    "Por favor verifique a data do relatorio nas propriedades do teste");
}

// Garantir que a data de "getNullifiedTickets - Request 1" é um dia anterior à data da volta do askPlaces original
assert ticketNo2.contains(ticketNo1)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文