apache / jmeter

Apache JMeter open-source load testing tool for analyzing and measuring the performance of a variety of services
https://jmeter.apache.org/
Apache License 2.0
8.29k stars 2.09k forks source link

Add download of embedded resources using HTML5 tags in HTTP Requests #4884

Open asfimport opened 6 years ago

asfimport commented 6 years ago

juergen.plasser (Bug 62784): Currently it is not possible to download HTML5 embedded resources eg. <picture> in HTTP Requests. Please add this functionality.

Or is it possible to use a different HTML parser to gain more functionality? And if yes, which one is recommended by you guys?

Regards Jürgen

OS: All

asfimport commented 6 years ago

@pmouawad (migrated from Bugzilla): (In reply to juergen.plasser from comment 0)

Currently it is not possible to download HTML5 embedded resources eg. <picture> in HTTP Requests. Please add this functionality.

Or is it possible to use a different HTML parser to gain more functionality? And if yes, which one is recommended by you guys?

The default one LagartoBasedHtmlParser is the best and more up to date one.

Regarding picture, how would you specify the browser definition to match the media query ?

Also regarding load, since <img> is mandatory, you would end up anyway downloading 1 resources, potentially not the one associated to the browser definition.

Feel free to propose a patch : https://github.com/apache/jmeter/blob/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/LagartoBasedHtmlParser.java

Regards Jürgen

asfimport commented 5 years ago

juergen.plasser (migrated from Bugzilla): Since the load depends on the size of the img we will need a setting to define the media properties. This is an example of the source I have, different media sizes and one fallback image:

<figure class="..."> <div class="..."> <picture> <source media="(min-width: 1220px)" srcset="/...png 1x, /...png 2x"> <source media="(min-width: 768px) and (max-width: 1219px)" srcset="/...png 1x, /...png 2x"> <source media="(min-width: 576px) and (max-width: 767px)" srcset="/...png 1x, /...png 2x"> <img src="data:image/gif;base64,...==" srcset="/...png 1x, /...png 2x" alt="Alt"> </picture> </div> </figure>

In this case I do not see any <img> tag (the fallback image) being downloaded, surely because it's embedded (?). From my understanding JMeter has to implement a flexible and versatile parallel download mechanism that follows the HTML5 spec. As the image size depends on the media attribute, I think it's a good start to have some media regex to filter the sources and always download the first match or the fallback, if nothing matches.

But speaking for this case above, JMeter does not recognize the srcset attribute and therefore not any download is processed. That's imho not a parser issue, it's an issue of the "embedded resource download" function of the HTTP Requests sampler.

How can I propose new features for JMeter? Is this the right place to go?

-Jürgen

asfimport commented 5 years ago

@pmouawad (migrated from Bugzilla): (In reply to juergen.plasser from comment 2)

Since the load depends on the size of the img we will need a setting to define the media properties. This is an example of the source I have, different media sizes and one fallback image:

<figure class="..."> <div class="..."> <picture> <source media="(min-width: 1220px)" srcset="/...png 1x, /...png 2x"> <source media="(min-width: 768px) and (max-width: 1219px)" srcset="/...png 1x, /...png 2x"> <source media="(min-width: 576px) and (max-width: 767px)" srcset="/...png 1x, /...png 2x"> <img src="data:image/gif;base64,...==" srcset="/...png 1x, /...png 2x" alt="Alt"> </picture> </div> </figure>

In this case I do not see any <img> tag (the fallback image) being downloaded, surely because it's embedded (?).

Yes as it's embedded in img no download occurs

From my understanding JMeter has to implement a flexible and versatile parallel download mechanism that follows the HTML5 spec. As the image size depends on the media attribute, I think it's a good start to have some media regex to filter the sources and always download the first match or the fallback, if nothing matches.

But speaking for this case above, JMeter does not recognize the srcset attribute and therefore not any download is processed. That's imho not a parser issue, it's an issue of the "embedded resource download" function of the HTTP Requests sampler.

The parser currently ignores picture And indeed there should be a place to indicate what media regex to use (or browser definition)

How can I propose new features for JMeter? Is this the right place to go?

Yes, you can also use jmeter mailing list: https://jmeter.apache.org/mail2.html

-Jürgen