I would like to know in which scenario I can use "Main sample" or "Sub Sample" or both for Text Response in Response Assertion.
I googled it but have not yet receive satisfactory answers yet.
Help appreciated.
I would like to know in which scenario I can use "Main sample" or "Sub Sample" or both for Text Response in Response Assertion.
I googled it but have not yet receive satisfactory answers yet.
Help appreciated.
According to JMeter Help,
This is for use with samplers that can generate sub-samples, e.g. 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 main sampler has all required response data but nowadays because of ajax, jquery framework single request can spawn multiple sub-requests internally and each has its response data.
Thus In most cases searching in main samplers response is enough
But if you know or you found out that request has multiple sub-requests and response can be anywhere then you can choose "main samples and sub samples" radio button so that you wont miss sub requests.
When you select 'Retrieve All Embedded Resources' the HTTP request you have it might generate sub samplers (for img, css, js files etc). You select the option in the Response Assertion accordingly based on the samplers where you expect your 'expected text' to be present.