flood-io / ruby-jmeter

A Ruby based DSL for building JMeter test plans
MIT License
748 stars 139 forks source link

Is it possible to start a Jmeter HTTP proxy recorder? #130

Open djangofan opened 6 years ago

djangofan commented 6 years ago

Is it possible to start a Jmeter HTTP proxy recorder? Does something like this already exist in this DSL?

I want to run regular Ruby api tests through such a Jmeter recorder proxy and generate a .jmx file from it. Then I want to set the domain-name/threads/ramp-up/duration on that test suite to run at load without using Ruby but instead from the recordings.

Of course, it would be important to be able to specify the Thread Group name to save all the recorded traffic within a default/specific "Recording Controller".

Can you provide an example of this somewhere in the project or in the documentation?

Alternatively, I suppose I could start with a prepared recording template.jmx . If I do it that way, does ruby-jmeter have the ability to modify information in an already existing .jmx file, such as Thread Group properties?

sergeyradov commented 5 years ago

Hello @djangofan, thank you for your question. Let me try to explain how it is possible to figure out the answer.

This GEM is pretty plain, it takes your ruby code and "converts" (read as concatenates) corresponding xml document fragments into a JMeter based XML. to figure out that answer on your questions, I would create a JMeter scenario in plain JMeter with proxy recorded and save it on the local machine. Extract names of internal class names from JMX (xml) and search through that repository. If you find something similar to the Proxy class name, it means yes, there is some support. If not, then the answer is obvious. Let me try to do that for you.

sergeyradov commented 5 years ago

@djangofan Here is what I found inside JMX

      <ProxyControl guiclass="ProxyControlGui" testclass="ProxyControl" testname="HTTP(S) Test Script Recorder" enabled="true">
        <stringProp name="ProxyControlGui.port">8888</stringProp>
        <collectionProp name="ProxyControlGui.exclude_list"/>
        <collectionProp name="ProxyControlGui.include_list"/>
        <boolProp name="ProxyControlGui.capture_http_headers">true</boolProp>
        <intProp name="ProxyControlGui.grouping_mode">0</intProp>
        <boolProp name="ProxyControlGui.add_assertion">false</boolProp>
        <stringProp name="ProxyControlGui.sampler_type_name"></stringProp>
        <boolProp name="ProxyControlGui.sampler_redirect_automatically">false</boolProp>
        <boolProp name="ProxyControlGui.sampler_follow_redirects">true</boolProp>
        <boolProp name="ProxyControlGui.use_keepalive">true</boolProp>
        <boolProp name="ProxyControlGui.sampler_download_images">false</boolProp>
        <intProp name="ProxyControlGui.proxy_http_sampler_naming_mode">0</intProp>
        <stringProp name="ProxyControlGui.proxy_prefix_http_sampler_name"></stringProp>
        <stringProp name="ProxyControlGui.proxy_pause_http_sampler"></stringProp>
        <boolProp name="ProxyControlGui.notify_child_sl_filtered">false</boolProp>
        <boolProp name="ProxyControlGui.regex_match">false</boolProp>
        <stringProp name="ProxyControlGui.content_type_include"></stringProp>
        <stringProp name="ProxyControlGui.content_type_exclude"></stringProp>
      </ProxyControl>
sergeyradov commented 5 years ago

@djangofan by searching this in the repository I got nothing. https://github.com/flood-io/ruby-jmeter/search?q=ProxyControl&unscoped_q=ProxyControl So, you might request a feature as an extension or send a PR with corresponding change. cc @90kts 👍

sergeyradov commented 5 years ago

@90kts Could you please decide which label to set here. If it will become an extension, we can sort out what to do to all of them. e.g. hackathon at FreeCode camp?

sergeyradov commented 5 years ago

I would be happy to help