Данные, к которым вы хотите получить доступ, находятся в вашей переменной "вызывающая сторона", но вызывающая сторона - это массив.
Все общие параметры сценариев находятся там, запрос выполнен,response, заголовки и responseTime и т. д.
Для доступа ко времени:
assert caller[0].responseTime > 10
Для доступа и подтверждения ответа:
* xml soapResponseXml = caller[0].response
* match soapResponseXml /Envelope/Body/AddResponse/AddResult == 4
Вотрабочий пример.Функция звонящего:
Feature: Caller Feature
Background:
* def soap = read('common.feature')
Scenario: soap 1.2
* table parameters
| param_a | param_b |
| 1 | 3 |
* def caller = call soap parameters
* print caller
* xml soapResponseXml = caller[0].response
* match soapResponseXml /Envelope/Body/AddResponse/AddResult == 4
* assert caller[0].responseTime > 10
Общая функция:
Feature: Common Soap Feature
Background:
* url 'http://www.dneonline.com/calculator.asmx'
Scenario:
* def soap = read('request.xml')
* replace soap
| token | value |
| @@a@@ | param_a |
| @@b@@ | param_b |
Given request soap
When soap action 'http://tempuri.org/Add'
Then status 200
И шаблон запроса XML:
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<Add xmlns="http://tempuri.org/">
<intA>@@a@@</intA>
<intB>@@b@@</intB>
</Add>
</soap12:Body>
Ниже приведенвывод из * print caller
в функции вызывающего абонента:
[
{
"param_b": 3,
"responseTime": 846,
"requestMethod": "POST",
"requestParams": null,
"requestUri": "http://www.dneonline.com/calculator.asmx",
"responseStatus": 200,
"__loop": 0,
"__arg": {
"param_a": 1,
"param_b": 3
},
"requestHeaders": {
"SOAPAction": [
"http://tempuri.org/Add"
],
"Content-Type": [
"text/xml"
]
},
"responseHeaders": {
"Cache-Control": [
"private, max-age=0"
],
"Content-Length": [
"323"
],
"Content-Type": [
"application/soap+xml; charset=utf-8"
],
"Server": [
"Microsoft-IIS/7.5"
],
"X-AspNet-Version": [
"2.0.50727"
],
"X-Powered-By": [
"ASP.NET"
],
"Date": [
"Thu, 27 Sep 2018 19:57:50 GMT"
]
},
"requestBody": "<soap12:Envelope xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n <soap12:Body>\n <Add xmlns=\"http://tempuri.org/\">\n <intA>1</intA>\n <intB>3</intB>\n </Add>\n </soap12:Body>\n</soap12:Envelope>",
"response": {
"soap:Envelope": {
"_": {
"soap:Body": {
"AddResponse": {
"_": {
"AddResult": "4"
},
"@": {
"xmlns": "http://tempuri.org/"
}
}
}
},
"@": {
"xmlns:soap": "http://www.w3.org/2003/05/soap-envelope",
"xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
"xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance"
}
}
},
"requestTimeStamp": 1538078269984,
"param_a": 1,
"parameters": [
"#ref:java.util.LinkedHashMap"
],
"soap": "<soap12:Envelope xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n <soap12:Body>\n <Add xmlns=\"http://tempuri.org/\">\n <intA>1</intA>\n <intB>3</intB>\n </Add>\n </soap12:Body>\n</soap12:Envelope>",
"responseCookies": null
}
]