您的位置:首页 > 其它

JMeter Test Plan的组成部分之Assertions

2016-03-27 23:53 507 查看

JMeter Test Plan的组成部分之Assertions

Assertions allow you to
include some validation test on the response of your request made using a Sampler. They are inserted as
a child component of a Sampler. Assertions are particularly necessary in functional testing of your applications,

while, in performance testing, you may want to use assertion to ensure the responses you receive. Do not contain content errors or missing sections, as this may affect the validity of your test.

With Assertion, you can assert whether the application is returning the expected result or not. JMeter allows you to specify your assertions using Perl-style regular
expressions.


You can create these assertions using regular expressions.

Let's say, you want to ensure that, in an HTTP Request Sampler, the page you request contains the text 'Login Successful' to indicate successful access to a page.

You may use Response Assertion
to specify if the response does contain the text at all. If JMeter cannot find the text, then it will indicate this as failed request.

As an example, the Response Assertion Control Panel
looks like this:



Associated with Assertions are Listeners such as "Assertion", "View Result in Table","View Result Tree", "Aggregate Report" Listener, and "Summary Report" Listeners.

Assertion results will be shown in detail in the first three Listeners, while the rest will show the failed assertions only as summary percentage of failure.

As an example, the Assertion Results Control Panel looks like the following figure:



The following list consists of all the Assertions JMeter provides:

Response Assertion
Duration Assertion
Size Assertion
XML Assertion
BeanShell Assertion
MD5Hex Assertion
HTML Assertion
XPath Assertion
XML Schema Assertion

读书笔记:Apache JMeter
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: