JMeter: In which scenario can I use “Main Sample” or “Sub Sample” or both to respond to text in a response to a response

I would like to know in which scenario I can use the “Basic Sample” or “Sub Sample” or both to respond to the text in the response to the response.

I googled, but have not yet received satisfactory answers.

Help evaluate.

+5
source share
2 answers

According to JMeter help,

This is for use with samplers that can generate sub-samples, eg HTTP Sampler with embedded resources, Mail Reader or samples generated by the Transaction Controller. Main sample only - assertion only applies to the main sample Sub-samples only - assertion only applies to the sub-samples Main sample and sub-samples - assertion applies to both. JMeter Variable - assertion is to be applied to the contents of the named variable 

In most cases, only the main sampler has all the necessary response data, but currently due to ajax, a single request within the jquery framework can generate many sub-requests inside, and each of them has its own response data.

Thus, in most cases, searching in the main answer of the samplers is enough

enter image description here

enter image description here

But if you know or find out that the request has several subqueries, and the answer can be anywhere, then you can select the "main samples and sub-samples" radio button so that you don’t miss the sub-queries.

enter image description here

+5
source

When you select Get All Embedded Resources, the HTTP request that you have can generate sub-samples (for img, css, js files, etc.). You select the option in the statement of the response, respectively, based on the samplers, where you expect your "expected text" to be present.

  • Key samples and sub-samples: JMeter will check for the "expected text" in both the main and sub-samples, and if any of the samplers has no text, it fails.
  • Just a basic example: - JMeter will check the "expected text" only in the main example. It does not work if it is not found.
  • Subroutine only: - JMeter will check the "expected text" only in all sub-samples. All sub-samples are expected to have text. Otherwise it will not work.
0
source

Source: https://habr.com/ru/post/1212185/


All Articles