-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: WeightedSwitchController #93
Comments
What about modelling weighted switch controller like this: weightedSwitchController()
.child(25, mySampler)
.child(75, myOtherSampler)
.children(...) // for unweighted elements like pre, post, config, timers, assertions & listeners elements. If a sampler is added here you might take as default weight the same default the plugin uses (100). and child receiving just an int and DslTestElement as parameters? with such approach you wouldn't need the |
If you think that approach is good, and |
the problem is that we want to pass dsl elements to our methods such but then we need to configure weighted controller with Jmeter TestElements which primarily are building with buildTestElement() method from corresponding DslTestElements which in its turn are protected and unavailable to use :( |
Have you considered overwriting |
Maybe use float or double as first arg of child? |
For now buildTreeUnder is a sort of mystery for me) I don't fully understand what I should do with its result. |
of course) i think integers here are only for representation of numbers as such |
@rabelenda May you add some docs about buildTreeUnder() methods? and may be provide some examples of using them. |
Hello, buildTreeUnder already has some java doc on it: /**
* Builds the JMeter HashTree for this TestElement under the provided tree node.
*
* @param parent the node which will be the parent for the created tree.
* @param context context information which contains information shared by elements while building
* the test plan tree (eg: adding additional items to test plan when a particular protocol element
* is added).
* @return The tree created under the parent node.
* @since 0.17
*/
HashTree buildTreeUnder(HashTree parent, BuildTreeContext context); Maybe we could improve it as to make it more clear to devs how and when to override it. In the mean time you can check the logic associated in BaseTestElement: public HashTree buildTreeUnder(HashTree parent, BuildTreeContext context) {
return parent.add(buildConfiguredTestElement());
} Or any of the classes that implement the method (you can use IDE features to list and navigate to all clases implementing an interface method). For the particular case of WeightedSwitchController, there is no similar logic to what you will need, since as I mentioned, this controller has some specific non standard way of configuring (by getting info from children). In any case, you might get inspiration from RpsThreadGroup implementation: public HashTree buildTreeUnder(HashTree parent, BuildTreeContext context) {
HashTree ret = parent.add(buildConfiguredTestElement());
HashTree timerParent = counting == EventType.ITERATIONS ? ret.add(buildTestAction()) : ret;
timerParent.add(buildTimer());
children.forEach(c -> context.buildChild(c, ret));
return ret;
} And review, with a debugger, the resulting ret hashTree after adding children elements, and configuring the configuredTestElement with children and provided weights info. If you find it complex, since as previously mentioned this particular scenario is, let us know and we may invest on it and try to implement something. Regards |
Hello, was the provided info helpful? Regards |
hi! |
Awesome! looking forward for it! :) |
I'd like to propose some massive but easy changes.
In my attempts to implement dsl for
WeighedSwitchController
(bzm plugin) I have stucked with inability to buildTestElement
fromBaseTestElement
because it's under protected method.The main problem is in need to pass
TestElement
object toaddTestElement
method of anyGenericController
.So I don't see any problem to make public and give more flexibity to create new components. But maybe there are another possibilities to make this.
The text was updated successfully, but these errors were encountered: