📅  最后修改于: 2020-12-04 05:00:26             🧑  作者: Mango
断言可以解释为检查点或验证点。将请求发送到Web服务器后,就会收到响应。需要验证是否包含预期的数据响应。为了验证响应,SoapUI具有断言功能。
断言用于在执行期间验证TestStep接收到的消息。
它将消息的一部分或整个消息与某个期望值进行比较。
可以将任意数量的断言添加到TestStep,每个断言用于验证响应消息的某些不同方面和内容。
执行TestStep之后,其所有断言都将应用于接收到的响应,如果其中任何一个失败,则TestTest在TestCase视图中会标记为失败。
失败的条目显示在测试执行日志中。
SoapUI支持各种响应断言。
以下是SoapUI支持的断言列表。
Assertion | Description |
---|---|
Property Content | |
Contains | Checks for the existence of the specified string. It also supports regular expression. |
Not Contains | Checks for the non-existence of the specified string. It also supports regular expression. |
XPath Match | Uses XPath expression to select the target node and its values. Compares the result of an XPath expression to an expected value. |
XQuery Match | Uses an Xquery expression to select the content from the target property. Compares the result of an XQuery expression to an expected value. |
Compliance, Status, Standards | |
HTTP DOwnload All Resource | Downloads all resources referred to be an HTML document (images, scripts, etc.) and validates that they are all available. Applicable to any property containing HTML. |
Invalid HTTP Status Codes | Checks that the target TestStep received an HTTP result with a status code not in the list of defined codes. Applicable to any TestStep that receives HTTP messages. |
Not SOAP Fault | Validates that the last received message is not a SOAP Fault. Applicable to SOAP TestSteps. |
Schema Compliance | Validates that the last received message is compliant with the associated WSDL or WADL schema definition. Applicable to SOAP and REST Test Steps. The schema definition URL supports Property Expansions (e.g. ${#System#my.wsdl.endpoint}/services/PortType? wsdl). |
SOAP Fault | Validates that the last received message is a SOAP Fault. Applicable to SOAP TestSteps SOAP Request – validates that the last received request is a valid SOAP Request. Applicable to MockResponse Test Steps only. |
SOAP Response | Validates that the last received response is a valid SOAP Response. Applicable to SOAP TestRequest Steps only. |
Valid HTTP Status Codes | Checks that the target TestStep received an HTTP result with a status code in the list of defined codes. Applicable to any TestStep that receives HTTP messages. |
WS-Addressing Request | Validates that the last received request contains valid WS-Addressing Headers. Applicable to MockResponse TestSteps only. |
WS-Addressing Response | Validates that the last received response contains valid WS-Addressing Headers. Applicable to SOAP TestRequest Steps only. |
WS-Security Status | Validates that the last received message contained valid WS-Security headers. Applicable to SOAP Test Steps. |
Script | |
Script Assertion | Allows the users to execute a custom script to perform user-defined validations. Applicable to TestSteps only (i.e. not properties) |
SLA | |
Response SLA | Validates if the response time of the last received response was within the defined limit. Applicable to Script TestSteps and TestSteps that send requests and receive responses. |
JMS | |
JMS Status | Validates that the JMS request of the target TestStep is executed successfully. Applicable to Request TestSteps with a JMS endpoint. |
JMS Timeout | Validates that the JMS statement of the target TestStep did not take longer than the specified duration. Applicable to Request TestSteps with a JMS endpoint. |
Security | |
Sensitive Information Exposure | Verifies if the response message does not expose sensitive information about the target system. We can use this assertion for REST, SOAP and HTTP TestSteps. |
JDBC | |
JDBC Status | Validates that the JDBC request of the target TestStep executed successfully. Applicable to JDBC TestSteps only. |
JDBC Timeout | Validates that the JDBC statement of the target TestStep did not take longer than the specified duration. Applicable to JDBC TestSteps only. |