Bug 40671

Summary: IncludeController : UserDefinedVariables from Included Test plan not available in Includer Test plan
Product: JMeter - Now in Github Reporter: nrhope
Component: MainAssignee: JMeter issues mailing list <issues>
Status: RESOLVED WONTFIX    
Severity: major CC: p.mouawad
Priority: P2    
Version: 2.2   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: fixes the problem by "including" testplan's children/variables
Test Plan showing it works when using Test Fragment

Description nrhope 2006-10-03 18:18:11 UTC
This patch fixes a problem I had using the IncludeController in version 2.2,
where nothing other then User Defined Variable assignments were being imported
from the included .jmx file.

Because everything needs to be placed under a TestPlan in the IncludeController,
before JMeter run, it traverses the subtree of the IncludeController; it only
adds nodes which are instanceOf Sampler or Controller. Because TestPlan is not
in these categories, JMeter just omits it and its children and that is why the
IncludeController does not work.

The solution is to only return the subtree under the TestPlan when JMeter asks
for the replacement subtree. However, it means that all user defined variables
defined in the TestPlan will be lost, so we need to make a copy for all the user
defined variables from the TestPlan. Because the user defined variable
controller works anywhere in the tree, so it just needs to copy them to
somewhere in the tree (I choose to copy them as a child under the TestPlan).

There is one problem though, the nested IncludeController will not work. I tried
to fix it but it seemed to be quite a big task. As the most important part is
working so I don’t want to spend too much time on it unless someone proves to me
that it is worthwhile fixing.
Comment 1 nrhope 2006-10-03 18:20:07 UTC
Created attachment 18957 [details]
fixes the problem by "including" testplan's children/variables
Comment 2 Ryan 2007-05-30 20:35:31 UTC
Embedded IncludeControllers is definitely a useful feature - especially with
large-scale tests.  For instance, I have several independent tests that include
common components (Login, Logoff, etc).  I also am trying to create a more
comprehensive test that runs all of the independent tests together by including
them.  Due to the bug mentioned above, the component controllers do not get
called and the scripts fail due to not being logged in and missing other common
bits.  

Comment 3 Philippe Mouawad 2011-11-14 12:13:07 UTC
Still in 2.5.1
Comment 4 Philippe Mouawad 2012-03-22 08:16:29 UTC
Created attachment 28496 [details]
Test Plan showing it works when using Test Fragment
Comment 5 Philippe Mouawad 2012-03-22 08:18:05 UTC
Since JMeter 2.5, Test Fragment has been introduced and is the recommanded (and supported) way of using IncludeController.

Using this solution, User Defined Variable assignments are being imported as the attached test plan shows it.

I close issue as WONTFIX.
Comment 6 The ASF infrastructure team 2022-09-24 20:37:38 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/1802