Jmeter response interface's assertion Detailed

In response to the assertion:

In response to the server's assertion check

Apply to

应用范围: main sample and sub sample, main sample only , sub-sample only , jmeter variable

About range of applications, most of us check the "main sample only" enough, because we have a request, essentially only one request. But when we made a request, it can trigger multiple server requests, like ajax that, then there is main sample and the sub-sample of the points. In addition, there is the redirection of requests, and check the "follow the redirect," then the two requests are sub-sample, request (second request) is redirected after the main-sample, about the main sample and sub sample, we are interested can look at this post: Posts

Response field

Application: in response to a text, Document (Text), url sample, response code, the response information, Response Header, ignore status

  • Response text: server response text, ordinary http response are checking this.

  • Document (Text): Apache Tika support all server response, including text response, also supports PDF, Office, Audio, Video formats. jmeter will Tika to parse the server response content with Apache, would be a waste of memory, but also very easy to parse failure. So ordinary http request, do not choose this.

  • url sample: Is the url sample were assertion. If the request is not redirected (302), so that this is the request url. If you have redirected (and follow the redirect), then the url contains the request url redirection and url

  • Response code: http response code, such as 101,200,302,404,501 and the like. But when we want to verify that 404,501 such as http response code, you need to check the "ignore status". Because when the http response code 400,500, jmeter the default request failed.

  • Response information: http response information corresponding to the response code, for example: OK, Found

    HTTP/1.1 200 Ok   
    HTTP/1.1 302 Found
    
  • Response Header: header in response to information, e.g.

    Server: Tengine
    Date: Thu, 12 Mar 2015 09:43:52 GMT
    Content-Type: text/html
    Content-Length: 260
    Connection: close
    Location: http://www.baidu.com/404.html
    

Pattern matching rules

Big Box   Jmeter response interface of assertion Detailed 3 id = "include: return results include content you specify, to support the regular matching"> Includes: return results include content you specify, to support the regular matching
  例如:
  响应字段为: 响应文本
  模式匹配规则:匹配
  断言为:1、invalid    2、[a-z]+
  当返回值为:{"msg":"channel invalid."} , 这两个断言都是ok的,返回true

match:

(1) corresponds equals. When the return value is fixed, the return value may be asserted, and the same effect equals

(2) a regular match. Expression match returns with a positive result, but must all match. That is the regular expression must match the whole return value instead of returning part of the value.

  例如:
  响应字段为: 响应文本
  模式匹配规则:匹配
  断言为:1、{"msg":"channel invalid."}   2、{"msg":"[a-z]+ invalid."}  , 3、[a-z]+
  当返回值为:{"msg":"channel invalid."}   ,断言1 2 是ok的, 断言3是false
  当返回值为:{"msg":"channel invalid."} , 断言1 3是false, 断言2才是ok的。
  原因是,断言1 只能用于equals,而断言3 只匹配了返回值部分,而不是全部匹配。

Equals: results and return you to specify exactly the same assertion

SubString: and "including" almost all refer to return results include content you specify, but does not support regular string subString

  例如:
  响应字段为: 响应文本
  模式匹配规则:匹配
  断言为:1、invalid    2、[a-z]+
  当返回值为:{"msg":"channel invalid."} , 断言1返回true, 但断言2返回false
  否:就相当于取反。 如果上面断言结果为true,勾选“否”后,最终断言结果为false。如果上面断言结果为false,勾选“否”后,则最终断言结果为 true。

Guess you like

Origin www.cnblogs.com/lijianming180/p/12037855.html