Bug 58888

Summary: HTTP(S) Test Script Recorder (ProxyControl) does not add TestElement's returned by SamplerCreator createChildren ()
Product: JMeter - Now in Github Reporter: kostas
Component: HTTPAssignee: JMeter issues mailing list <issues>
Status: RESOLVED FIXED    
Severity: enhancement CC: michael.chirlin, p.mouawad
Priority: P2    
Version: 3.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Patch for ProxyControl

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
Comment 4 The ASF infrastructure team 2022-09-24 20:38:02 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/3788