Bug 58888 - HTTP(S) Test Script Recorder (ProxyControl) does not add TestElement's returned by SamplerCreator createChildren ()
Summary: HTTP(S) Test Script Recorder (ProxyControl) does not add TestElement's return...
Status: RESOLVED FIXED
Alias: None
Product: JMeter
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 3.0
Hardware: All All
: P2 enhancement with 1 vote (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-19 05:47 UTC by kostas
Modified: 2016-06-12 14:54 UTC (History)
2 users (show)



Attachments
Patch for ProxyControl (2.81 KB, patch)
2016-01-19 05:47 UTC, kostas
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description kostas 2016-01-19 05:47:30 UTC
Created attachment 33464 [details]
Patch for ProxyControl

Hi,

I am creating an addon which extends DefaultSamplerCreator and automates the addition of some assertions on the recorded requests. It looks that createChildren() method of SamplerCreator is the natural place for such a function.

I found however that ProxyControl only adds HeaderManager as children. The attached patch allows the ProxyControl to add ResponseAssertion, ResultSaver, and SizeAssertion. 

A more general way to add any assertion probably exists. If someone can point me to right direction, I will take a look.


Regards
kostas
Comment 1 Michael Chirlin 2016-05-22 23:23:20 UTC
The change should not specify the node type:

for (int i = 0; subConfigs != null && i < subConfigs.length; i++) {
  if (subConfigs[i] instanceof HeaderManager) {
    subConfigs[i].setProperty(TestElement.GUI_CLASS, HEADER_PANEL);
  }
  treeModel.addComponent(subConfigs[i], newNode);
}

Basically, the treeModel.addComponent needs to be pulled out of the if statement.  As long as you specify the TestElement.GUI_CLASS in the createChildren method, you don't need to do it again here.
Comment 2 Philippe Mouawad 2016-06-12 13:44:50 UTC
Author: pmouawad
Date: Sun Jun 12 13:44:17 2016
New Revision: 1748004

URL: http://svn.apache.org/viewvc?rev=1748004&view=rev
Log:
Bug 58888 - HTTP(S) Test Script Recorder (ProxyControl) does not add TestElement's returned by SamplerCreator createChildren ()
Bugzilla Id: 58888

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
    jmeter/trunk/xdocs/changes.xml
Comment 3 Felix Schumacher 2016-06-12 14:54:43 UTC
Minor refactorings.

Date: Sun Jun 12 14:14:37 2016
New Revision: 1748012

URL: http://svn.apache.org/viewvc?rev=1748012&view=rev
Log:
Syntactic sugar. First check for null, then use 'new' for loop.

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java

Date: Sun Jun 12 14:50:47 2016
New Revision: 1748016

URL: http://svn.apache.org/viewvc?rev=1748016&view=rev
Log:
Rename private methods to shorter names and add refactor testing for addable TestElements.

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java