Class TreeBuilder
-
- All Implemented Interfaces:
@API(status = API.Status.EXPERIMENTAL, since = "5.6") public final class TreeBuilder
Provides a programmatic way to build test plans.
Sample Kotlin:
testTree { TestPlan::class { OpenModelThreadGroup::class { name = "Thread Group" scheduleString = "rate(50 / sec) random_arrivals(100 ms) pause(2 s)" +DebugSampler() } } }
Sample Java:
testTree(b -> { b.add(TestPlan.class, tp -> { b.add(OpenModelThreadGroup.class, tg ->{ name = "Thread Group" scheduleString = "rate(50 / sec) random_arrivals(100 ms) pause(2 s)" b.add(new DebugSampler()); }); }); });
- Since:
5.6
-
-
Field Summary
Fields Modifier and Type Field Description private final ListedHashTree
tree
private final ListedHashTree
currentSubtree
private final List<TestElement>
elementStack
private final TestElement
currentElement
private final TestElement
parent
-
Constructor Summary
Constructors Constructor Description TreeBuilder()
-
Method Summary
Modifier and Type Method Description final ListedHashTree
getTree()
Resulting tree. final ListedHashTree
getCurrentSubtree()
final List<TestElement>
getElementStack()
final TestElement
getCurrentElement()
final TestElement
getParent()
final Unit
add(TestElement $self)
Adds a test element to the test tree. final <T extends TestElement> Unit
add(KClass<T> $self)
Adds a test element to the test tree. final <T extends TestElement> Unit
add(Class<T> $self)
Adds a test element to the test tree. final <T extends TestElement> Unit
add(KClass<T> $self, Action<T> configure)
Creates a test element and adds it to the test tree. final <T extends TestElement> Unit
add(Class<T> $self, Action<T> configure)
Creates a test element and adds it to the test tree. final <T extends TestElement> Unit
add(T $self, Action<T> configure)
Adds a test element to the test tree. final Unit
configureAll(Action<TestElement> configure)
Add an Action that will be executed after each element is added to the tree. final <T extends TestElement> Unit
configureEach(Action<T> configure)
Add an Action that will be executed after elements of given type (or its subtype) are added to the tree. final <T extends TestElement> Unit
configureEach(KClass<T> klass, Action<T> configure)
Add an Action that will be executed after elements of given type (or its subtype) are added to the tree. final <T extends TestElement> Unit
configureEach(Class<T> klass, Action<T> configure)
Add an Action that will be executed after elements of given type (or its subtype) are added to the tree. -
-
Method Detail
-
getTree
final ListedHashTree getTree()
Resulting tree.
-
getCurrentSubtree
final ListedHashTree getCurrentSubtree()
-
getElementStack
final List<TestElement> getElementStack()
-
getCurrentElement
final TestElement getCurrentElement()
-
getParent
final TestElement getParent()
-
add
final Unit add(TestElement $self)
Adds a test element to the test tree.
-
add
final <T extends TestElement> Unit add(KClass<T> $self)
Adds a test element to the test tree.
-
add
final <T extends TestElement> Unit add(Class<T> $self)
Adds a test element to the test tree.
-
add
final <T extends TestElement> Unit add(KClass<T> $self, Action<T> configure)
Creates a test element and adds it to the test tree. The test element class should have a no-argument constructor.
- Parameters:
configure
- block that configures the newly created test element, and optionally adds children elements
-
add
final <T extends TestElement> Unit add(Class<T> $self, Action<T> configure)
Creates a test element and adds it to the test tree. The test element class should have a no-argument constructor.
- Parameters:
configure
- block that configures the newly created test element, and optionally adds children elements
-
add
final <T extends TestElement> Unit add(T $self, Action<T> configure)
Adds a test element to the test tree.
- Parameters:
configure
- block that configures the test element, and optionally adds children elements
-
configureAll
final Unit configureAll(Action<TestElement> configure)
Add an Action that will be executed after each element is added to the tree.
-
configureEach
final <T extends TestElement> Unit configureEach(Action<T> configure)
Add an Action that will be executed after elements of given type (or its subtype) are added to the tree.
-
configureEach
final <T extends TestElement> Unit configureEach(KClass<T> klass, Action<T> configure)
Add an Action that will be executed after elements of given type (or its subtype) are added to the tree.
-
configureEach
final <T extends TestElement> Unit configureEach(Class<T> klass, Action<T> configure)
Add an Action that will be executed after elements of given type (or its subtype) are added to the tree.
-
-
-
-