Repository navigation
Conversation
milamberspace
left a comment
There was a problem hiding this comment.
Thanks for working on #6295, documenting how to actually run a DSL-built plan is a real gap in this page.
Main points
- The new doc section has no code sample. Every other section of this page comes with a
<source>block, and the issue reporter explicitly asked for the equivalent of the Java DSLjtlWriter(...)example. As it stands, readers still have to guessconfigure/runTest/awaitTerminationand how to set the JTL path, which is what the issue complained about. See the inline suggestion. - The test largely duplicates
OpenModelThreadGroupConfigElementTest(same plan, samescheduleString, sameDebugSampler, same engine/await sequence); only theResultCollectorand the JTL check are new. Its main value would be to guarantee that the documented snippet compiles and runs, so I'd suggest keeping the doc snippet and the test code in sync (same code, same idioms). Alternatively, the JTL assertions could be added to the existing test. Thethreads.openmodelpackage is also a slightly odd home for a test whose purpose is the DSL usage example.
Minor
- The JTL check
results.contains("Kotlin DSL sample")passes as soon as a single line is written; asserting 5 data lines (plus header) would verify that all samples were persisted. - The blank line that used to separate the two sections ended up inside the new section; there's now no blank line between
</section>and<section name="Extending Kotlin DSL">.
orimarko
left a comment
There was a problem hiding this comment.
@milamberspace Thank you for reviewing, I fixed the issues and move test to package kotlin/org/apache/jmeter/dsl
milamberspace
left a comment
There was a problem hiding this comment.
Thanks for the update! The documentation now has a proper code sample, the test lives in a better place, and the snippet uses the idiomatic DSL style.
Two things are still needed, and one is a regression introduced by keeping the test in sync with the docs (my earlier wording probably encouraged that, sorry):
- The test no longer asserts anything. All the assertions (number of samples, JTL file content) were removed, so the test would pass even if no sample was run and no file was written. The plan-building code can stay identical to the documentation, but the assertions should come back after it.
- The test writes into the source tree.
filename = "target/results.jtl"is relative, and Gradle runs the tests from the module directory, so each run createssrc/components/target/results.jtl. The repository.gitignoreonly ignores the top-level/target/, so that file shows up as untracked for contributors. The documentation can keeptarget/results.jtl, but the test should use a@TempDir.
See the inline comment for a version of the test I ran locally against this branch (passes, and leaves nothing behind).
- Minor: the indentation of the
<source>block in the documentation is inconsistent (nested blocks are misaligned, and the block starts with 8 spaces whereas the other samples of the page start at column 0). There is a suggestion inline.
Generated-by: GitHub Copilot
vlsi
left a comment
There was a problem hiding this comment.
F1 blocks the merge for me: a reader who pastes the new sample into their own program, rather than into a JMeter test that extends JMeterTestCase, gets a NullPointerException from awaitTermination and no JTL file.
F1, F2 and F3 are one change: make the page's sample the code a test compiles and runs without what JMeterTestCase prepares, so the setup and imports it needs show up on the page. The rest are small.
Not inline
F11 nit The description says "Part of #6295" without naming what of the issue stays open: JMeter functions such as __groovy in HTTPSamplerProxy fields, and referencing existing elements with ModuleController.
Problem: A maintainer deciding whether #6295 can close after the merge cannot tell which of its points this change answers; the author's plan for the rest lives only in an issue comment.
Reviewed at b6c92cbb.
Generated-by: GitHub Copilot
387b41b to
65686d3
Compare
Description
Document how to run a Kotlin DSL test plan
Motivation and Context
Part of #6295
Document how to execute a test plan built with the Kotlin DSL and write
sample results to a JTL file. Add a test that builds and runs a plan,
waits for completion, and checks the generated results.
How Has This Been Tested?
./gradlew :src:components:test --tests "*KotlinDslRunTest"
Types of changes
Checklist: