JMeter Test Plan的组成部分之Assertions

 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:

JMeter Test Plan的组成部分之Assertions_第1张图片


The following list consists of all the Assertions JMeter provides:
  1. Response Assertion
  2. Duration Assertion
  3. Size Assertion
  4. XML Assertion
  5. BeanShell Assertion
  6. MD5Hex Assertion
  7. HTML Assertion
  8. XPath Assertion
  9. XML Schema Assertion


读书笔记:Apache JMeter


你可能感兴趣的:(JMeter Test Plan的组成部分之Assertions)