JMeter .jmx Test Plan¶
Parses a JMeter .jmx test plan (JMeter's own <jmeterTestPlan>/<hashTree> XML dialect) into the Vayu draft model. Issue #1518.
- Source:
engine/src/core/jmeter_import.cpp(engine/include/vayu/core/jmeter_import.hpp) - Reader: pugixml, the one XML dependency in one translation unit - the same "one reader" rule
core::read_document(JSON/YAML) andcore::openapi_document.cpp(the YAML half of that) already follow, extended to a third dialect neither of those readers can parse.
Detection¶
A .jmx file is XML, so it fails both of core::read_document's readers (JSON, then YAML) the same way genuinely unrecognised bytes do. is_jmeter_document checks the raw text for <jmeterTestPlan within its first 4096 bytes, before parse_import ever calls read_document - the one exception to every other format's "one JSON/YAML read, then dispatch on the parsed document" rule (see the parser-architecture README).
The tree walk¶
A .jmx file's <hashTree> children alternate a test element (<ThreadGroup>, <HTTPSamplerProxy>, ...) with that element's own <hashTree> of children - JMeter's own serialization shape. The walk pairs them (for_each_paired_child) and dispatches on the element's tag name; nothing here is detected by guiclass except JMeter's own HttpDefaultsGui marker on a bare ConfigTestElement (JMeter reuses that one tag for several unrelated config panels).
enabled="false" excludes an element and everything nested under it, the same way JMeter itself never runs a disabled element's children either - checked once, in for_each_paired_child itself, so no individual dispatch site can forget it. Counted as <Tag>_disabled (e.g. HTTPSamplerProxy_disabled) rather than importing a request or controller the user had turned off as active with no way to disable it again.
Document order is kept (issue #2573). JMeter runs a plan's elements in the order the tree lists them and descends into a controller where it sits, so a sampler listed before or between controllers runs before the ones after it. Each sampler and each controller folder draft records its position among its parent's kept elements as order, one counter per parent across both kinds, and the apply numbers a parent's sub-folders and requests in that one sequence: the sidebar lists them and a recursive run visits them in the plan's order. The counter belongs to the collection being built, so the samplers of two ThreadGroups (which flatten into the same parent) continue one numbering; a disabled element and a setup or teardown group take no position. A plan of controllers only lists them as it always did.
Nesting is bounded. A .jmx skips read_document, so the walk applies MAX_READ_DEPTH (100 <hashTree> levels) itself, at the one function every recursive edge passes through. A branch nested past it is left out and counted under nesting_too_deep in meta.skipped; the rest of the file imports. Without the bound a file under the size cap could nest tens of thousands of levels and overflow a worker thread's stack.
TestPlanandThreadGroupflatten straight into the enclosing collection - Vayu has no thread-group concept, since a collection already runs every request once. ATestPlan's ownTestPlan.user_defined_variablesbecomes collection variables. AThreadGroupthat asks for more than one pass by one thread also leaves aThreadGroup_profilecount inmeta.skipped(Run profile), so the profile is not lost with the group.SetupThreadGroup/PostThreadGroup(JMeter's setUp/tearDown thread groups) look inside for a JSR223 or BeanShell sampler/pre/post-processor and take its script text asscript.setup/script.teardown(concatenated if more than one). Their samplers are never imported as requests - a request in the collection runs on every pass, a setUp sampler once - and are counted instead: see Setup and teardown groups.- A folder-shaping controller becomes a Vayu folder, walked the same way, and its members import inside it in source order.
LoopController,IfController,OnceOnlyController,TransactionControllerandThroughputControlleralso get their owncontrol.*element when the controller could be translated (see the table below).SwitchControllerand the controllers with no element-kind equivalent for their looping or selection (WhileController,ForeachController,RandomController,InterleaveControl,RandomOrderController,RunTime,CriticalSectionController,ModuleController,IncludeController,RecordingController) import as a plain folder, and so does a controller that could not be translated (an unparseableIfController.condition, aLoopControllerset to JMeter's "forever", aThroughputControllerin "total executions" style): the members are kept, the logic that shaped the folder is not, and each such controller is counted under<Tag>_unrecognisedinmeta.skipped(one count per controller, aggregated per tag) the same waybuild_leaf_elementscounts a recognised leaf kind it could not extract enough from, per the "nothing dropped quietly" rule below.GenericController(JMeter's Simple Controller) only groups, so it is a plain folder with nothing to count. HTTPSamplerProxybecomes a request; see Request mapping.- Everything else (
Arguments, HTTP defaults, and every extractor/assertion/timer/script kind in the table) attaches to whichever sink is walking when it is met: a sampler's own<hashTree>if this parser is inside one (Request mapping), the enclosing folder's or the collection's ownelementsotherwise - the same inheritance a Vayu-authored collection-level element already gets. AHeaderManageror a leaf kind met at the collection/folder level is not scoped down to "every sampler after it" the way JMeter's own scoping would place it; this parser does not attempt to resolve JMeter's scoping rules for them. HTTP Request Defaults are the exception: their path and timeouts are resolved onto the samplers in their scope (HTTP Request Defaults).
Class mapping¶
A number is read however JMeter saved it: a <stringProp> (what the GUI writes, so ${var} can stand in for it), an <intProp> or <longProp>, or the nested <doubleProp> / <FloatProperty> form with <name> and <value> children. Text that is not wholly a number (a ${var}, a blank) is never guessed at: the element is refused and counted under its _unrecognised kind, or, for a match number, falls back to JMeter's first match.
| JMeter class | Vayu | Notes |
|---|---|---|
TestPlan, ThreadGroup |
flattens into the collection | no per-user loop count, no thread count - a load run configures those separately; a non-default profile is counted as ThreadGroup_profile, naming the values (Run profile) |
SetupThreadGroup, PostThreadGroup |
script.setup, script.teardown |
only when a JSR223/BeanShell script is found inside; every sampler left out is counted under the group's tag (Setup and teardown groups) |
HTTPSamplerProxy (+ HeaderManager in its own <hashTree>) |
a request, with headers | see Request mapping; HTTPSampler.follow_redirects / HTTPSampler.auto_redirects (either true means Vayu's followRedirects is true) carry through; HTTPsampler.Arguments become query params or a form body by method (Request mapping); HTTPsampler.Files (a multipart file upload, issue #1657) becomes a form-data body row per file - a HTTPFileArg with no File.paramname is counted as HTTPsampler.Files instead, since it names nothing a field could key on and is nested inside the sampler tag itself, so it would otherwise never reach the sibling-tag tally |
LoopController |
folder + control.loop |
LoopController.loops of -1 (JMeter's "forever"), or one that is not a number (a ${var}, a blank), has no control.loop equivalent - the folder still imports as a plain grouping and the controller is counted as LoopController_unrecognised |
IfController |
folder + control.if |
only the "${var}" == "value" / != shape translates into {{var}} == value; anything else (a JS expression, &&/||) is left unmapped |
OnceOnlyController |
folder + control.once |
|
TransactionController |
folder + control.transaction |
named from testname |
ThroughputController |
folder + control.throughput |
the percent is read from the nested <FloatProperty> JMeter's GUI saves (or a flat ThroughputController.percentThroughput string prop). ThroughputController.style 0 ("total executions", a cap on a count with no percent) has no control.throughput equivalent - the folder still imports and the controller is counted as ThroughputController_unrecognised instead of importing a percent the plan never set |
GenericController (Simple Controller) |
folder only | groups its members and nothing else, so nothing is counted |
SwitchController |
folder only | JMeter selects by list index or a raw variable value, neither of which maps onto control.switch's named-case grammar without inventing case names the plan never declared |
WhileController, ForeachController, RandomController, InterleaveControl, RandomOrderController, RunTime, CriticalSectionController, ModuleController, IncludeController, RecordingController |
folder only | members import in source order; the loop condition, iteration source, random or interleaved selection, time limit, lock or reference to another part of the plan is not carried, and each controller is counted as <Tag>_unrecognised |
JSONPostProcessor |
extract.json, one per reference-name / JSONPath pair |
JMeter keeps a multi-value extractor's names, paths, default values and match numbers as parallel ;-separated lists; each pair becomes its own extractor, with the default and the match number (0 random, -1 every match) read by the same index (a list that ends early leaves the rest with no default and the first match). Lists are split the way Java's String.split does, so a trailing ; adds nothing. Names and paths of different lengths, or an empty name or path between separators, cannot be paired: nothing is imported and the processor is counted as JSONPostProcessor_unrecognised |
RegexExtractor |
extract.regex |
useHeaders maps to field: "headers". The pattern is copied as written, and Vayu runs it with RE2 rather than Java's engine: a pattern using a backreference (\1) or lookaround ((?=, (?<=, ...) is not imported: the extractor is dropped and counted as extract.regex_unmappable, because RE2 refuses it and a stored extractor could never run (regular expressions) |
BoundaryExtractor |
extract.boundary |
a new kind this issue adds - leftBoundary/rightBoundary, JMeter has no field selector for one either |
ResponseAssertion |
assert.status (test field is response code) or assert.contains (otherwise) |
Assertion.test_type is a bitmask (1 Matches, 2 Contains, 4 Not, 8 Equals, 16 Substring, 32 Or), read in full: the Not bit (4) becomes negate: true on every emitted assert.contains; the pattern kind follows JMeter's own precedence - Equals (8) → mode: "equals", Substring (16) → mode: "contains" (a plain text search), Matches (1) or Contains (2) → mode: "matches" (both are a regular-expression search in JMeter; the same RE2 caveat as RegexExtractor applies: a pattern RE2 refuses drops the assertion, counted as assert.contains_unmappable; so is a Substring assertion on an empty string, which every response contains, #3055). Several patterns without Or must all hold, so each pattern becomes its own assert.contains in the order JMeter lists them, every one with the same field, mode and Not (each is judged and inverted on its own, as in JMeter), and a pattern RE2 refuses drops only itself. An Or assertion (32) with more than one pattern means "any of these passes", which no Vayu kind expresses - refused and counted as ResponseAssertion_or rather than emitted as ANDed assertions; a single pattern with Or set is just that pattern. A response-code assertion stays one assert.status listing every code. A response-code assertion (Assertion.test_field is Assertion.response_code) with Not set is refused the same way, since assert.status has no negate. Assertion.test_field selects assert.contains's own field: Assertion.response_headers → headers, Assertion.sample_label ("URL Sampled") → url, absent/Assertion.response_data → body; any other value (Request Data, Request Headers, Response Message, Document) has no field to land on and is refused rather than collapsed onto body. Every refusal here (an unmapped field, an unresolvable response-code list, a Not on a response-code assertion, an unmapped Or) is counted as ResponseAssertion_unrecognised except the Or case, which gets its own ResponseAssertion_or tally |
DurationAssertion |
assert.duration |
|
SizeAssertion |
assert.size |
only JMeter's Equal operator maps precisely (op: "eq"); every other operator code has drifted across JMeter releases and falls back to assert.size's own default (lte) |
JSONPathAssertion |
assert.jsonpath |
INVERT → negate; JSONVALIDATION + EXPECTED_VALUE → expected, else exists: true |
ConstantTimer |
timer.think (fixed ms) |
|
UniformRandomTimer |
timer.think (minMs/maxMs) |
ConstantTimer.delay is the floor, + RandomTimer.range the ceiling; either missing or not a number (a ${var}) leaves the timer unimported and counted as UniformRandomTimer_unrecognised |
GaussianRandomTimer |
timer.think (gaussian) |
ConstantTimer.delay → meanMs, RandomTimer.range → deviationMs; refused and counted as GaussianRandomTimer_unrecognised on the same terms as the uniform timer |
ConstantThroughputTimer |
timer.pacing |
JMeter's rate is samples/minute; everyMs = 60000 / throughput. calcMode == 0 ("this thread only") is perUser: true, every other mode perUser: false. The rate is read from the nested <doubleProp> JMeter's GUI saves; one that is not a positive number (a ${var}) is counted as ConstantThroughputTimer_unrecognised |
JSR223Pre/PostProcessor, BeanShellPre/PostProcessor |
script.pre / script.post, imported disabled |
Groovy and BeanShell are not JavaScript; the element carries the source text as a comment when JMeter's own script property is empty |
Arguments (User Defined Variables) |
collection variables | merged wherever the node sits in the tree (TestPlan, or a bare Arguments node) |
ConfigTestElement with guiclass="HttpDefaultsGui" (HTTP Request Defaults) |
the baseUrl variable of the folder or collection it sits in, and the path and timeouts of the requests in its scope |
baseUrl only when it names a domain: protocol://domain[:port] with ${x} rewritten to {{x}} and an empty protocol read as http. Its path and its connect and response timeouts are resolved onto the samplers it covers (HTTP Request Defaults) |
XPathExtractor, XPath2Extractor, CookieManager, CSVDataSet, AuthManager, every listener (ResultCollector and its kin) |
not mapped | counted by class name - see Drop counting |
Run profile¶
Vayu keeps threads, ramp-up, duration and loops on the load run, not on the collection, so a ThreadGroup cannot carry them across. Instead of dropping them quietly, every enabled ThreadGroup whose profile is not the defaults is counted once under ThreadGroup_profile in meta.skipped, and the item's names hold one line per group with the values as written in the plan, e.g. Users: 10 threads; ramp-up 5s; duration 60s; 3 loops:
| Part | Read from | Shown |
|---|---|---|
| threads | ThreadGroup.num_threads |
always |
| ramp-up | ThreadGroup.ramp_time |
only with more than one thread (a single thread starts at once) |
| duration | ThreadGroup.duration |
only with ThreadGroup.scheduler on, as JMeter ignores it otherwise |
| loops | LoopController.loops inside ThreadGroup.main_controller (string or int), -1 shown as forever |
always |
The values stay as written, so a ${__P(users,10)} function call reads as that text. A group at the defaults - one thread, one pass, no duration, or none of the properties at all - has nothing to set and is not counted; a disabled group is counted as ThreadGroup_disabled like any disabled element and not as a profile (nothing under it imports). The samplers inside an enabled group import as requests whatever its profile.
The preview shows it as a note, not a warning, since every request imports and only a load test would run with other load than the plan: "1 thread group run profile not imported (Users: 10 threads; ramp-up 5s; duration 60s; 3 loops) - set the load, ramp-up and duration when you start the load test", with up to three groups spelled out and "+N more" after them.
Setup and teardown groups¶
A SetupThreadGroup or PostThreadGroup is counted under its own tag name (SetupThreadGroup, PostThreadGroup), and the count is the number of samplers inside it at any depth, controllers included - the number of requests to rebuild by hand. A group with no sampler inside and no script that imported is still one loss, so the count is never below 1 for a group that left something out. The samplers are not imported as requests and meta.requestCount does not include them. When a JSR223/BeanShell script does import as script.setup / script.teardown, a scripted sampler that became that script is not a loss, but any other sampler beside it still is and is counted. Samplers are recognised by the JMeter naming (HTTPSamplerProxy, JDBCSampler, ... any tag ending Sampler or SamplerProxy, and TestAction).
The preview words the count as samplers, not groups, and shows it as an action since requests are missing: "2 setUp samplers not imported - a request runs on every pass, so send them from a setup script instead", and the same for tearDown with a teardown script.
Request mapping¶
One HTTPSamplerProxy becomes one request:
- URL.
HTTPSampler.domainpresent → an absolute URL (protocol://domain[:port]path,${var}rewritten to{{var}}; a protocol that is empty or blank, as JMeter saves one left unset, ishttp, the same as an absent one); absent →{{baseUrl}}+ path, so a sampler that relies on a plan-level HTTP Request Defaults element still resolves once that element'sbaseUrlvariable is set. A sampler whose own path is empty or blank takes the path of the defaults in its scope (HTTP Request Defaults). - Timeout.
HTTPSampler.connect_timeoutandHTTPSampler.response_timeout, or the defaults' for one the sampler leaves blank, become the request'stimeout: their sum in milliseconds, absent when both are blank or0(Timeouts). - Body. A sampler carrying
HTTPsampler.Files→{mode: "form-data", fields: [...]}: one file field perHTTPFileArg(File.paramnameaskey,File.pathassrc- sent only once picked or allowed, since it names a file on the exporting machine,File.mimetypeascontentTypewhen present), with anyHTTPsampler.Argumentsfolded in beside them as plain fields - a file has no query-string or raw-body form to take instead, so this is the one case whereHTTPSampler.DO_MULTIPART_POSTplays no part in the decision. Otherwise,HTTPSampler.postBodyRawtrue and at least one argument →{mode: "text", content: <the one argument's value>}, whatever the method. Otherwise theHTTPsampler.Argumentsgo where JMeter sends them for the sampler's method (issue #3191; the method is trimmed and case-folded for the decision):GET,DELETE,HEADandOPTIONS→paramsrows (enabled), which the import joins into the URL's query; every other method (POST,PUT,PATCH, a custom verb) → a body,{mode: "x-www-form-urlencoded", fields: [...]}, or{mode: "form-data", ...}whenHTTPSampler.DO_MULTIPART_POSTis true, and nothing in the query. A sampler with no arguments gets no body. The engine addsContent-Type: application/x-www-form-urlencodeditself for the first shape, and aHeaderManagerContent-Typerow wins over it. - Headers. A
HeaderManagerdirectly inside the sampler's own<hashTree>becomes the request'sheadersrows. - Elements. Every recognised extractor/assertion/timer/processor directly inside the sampler's own
<hashTree>becomes a request-level element, in encounter order.
HTTP Request Defaults¶
An HTTP Request Defaults element covers the samplers at its own level and everything nested below it, wherever it sits among them: a sampler that comes before it in the file is covered too, and a sampler in a sibling folder or thread group is not. The import resolves that scope before it walks a level, so document order does not matter. Defaults at an outer level are overridden by nearer ones field by field (an inner element that sets only a timeout still inherits the outer path), and among defaults at one level the later one wins a field both set, as in JMeter. A disabled element covers nothing.
What reaches a request:
| Setting | Becomes | Rule |
|---|---|---|
| domain, protocol, port | the baseUrl variable of the folder or collection the element sits in |
read by a sampler that names no domain of its own ({{baseUrl}} + its path); variables propagate by the folder tree, not by the scope above |
| path | the request's URL path | JMeter uses a default path only for a sampler whose own path is empty or blank, so it is a fallback and never a prefix: a sampler with a path of its own keeps it. ${x} is rewritten to {{x}} as in any URL |
| connect timeout, response timeout | the request's timeout |
see below |
Timeouts¶
A sampler's own HTTPSampler.connect_timeout and HTTPSampler.response_timeout (milliseconds) are read whether or not a defaults element exists. Each one a sampler leaves blank falls back to the defaults in scope, and a value the sampler states, 0 included, replaces the default for that field alone. The request's timeout (milliseconds) is the sum of the two, because Vayu has one total timeout for the whole request, not one for the connect phase and one for the response:
- a blank or
0timeout is JMeter's "none" and adds nothing; with both none the request gets notimeoutand uses thedefaultTimeoutsetting, never0; - the sum is held to the 1 to 86400000 range a request's
timeouttakes; - a value that is not a whole non-negative number (a
${var}, a negative) is left out of the sum, and the request is counted once underHTTPSampler_timeout_unrecognised, so the lost part is never silent; - a request that ends up with both a connect and a response timeout is counted under
Timeout_total, once per request, with the request's name undernames(commas replaced by spaces, since the app joinsnameswith commas). The sum is a longer limit on the connect phase than JMeter had, and the notice says so.
The preview shows both as notes, since the request imports and sends: "1 request has both a connect and a response timeout (Login) - Vayu has one total timeout, so they were added", with up to three requests spelled out and "+N more" after them, and "1 request has a timeout that is not a number (such as ${t}) and was left out - set the timeout on the request".
Drop counting¶
Every class this parser has no mapping for is counted under its own literal tag name, and every recognised class it could not extract enough from (an empty pattern, an unparsable delay, a controller it could not translate) under that tag plus a suffix (<Tag>_unrecognised, ResponseAssertion_or, <kind>_unmappable) (meta.skipped); a ThreadGroup's run profile is the count that is not a loss of the import's own accuracy but of a setting the collection has no place for (ThreadGroup_profile, with names, see Run profile), and a request with two timeouts is counted as Timeout_total because Vayu adds them (see Timeouts), shown in the import preview the same way every other format's losses are (issue #1443, "nothing dropped quietly"). JMeter's own class list is open-ended - third-party plugins add more of them - so this is not the closed, enumerable SkippedItem.kind set every other format counts against: ImportTally::items() falls back to emitting any kind outside its fixed order list (in first-encountered order) rather than silently losing it, and the preview (import-notices.ts) renders the raw class name for one with no hand-written label: a _disabled class is not shown (it was switched off in JMeter), an _unmappable element is shown as dropped, and anything else as not imported.
A refused element is counted once. Whichever parser looked at it records its own kind, and the bare tag is added only for a class no parser looked at, so one element is never listed twice in the preview.
An element this parser does build is still validated against the live element registry (Registry::validate) before it reaches the draft, the same gate a stored request's own write goes through - a mistranslation is dropped and counted as <kind>_unmappable rather than reaching POST /import/apply, whose write is atomic across the whole tree.
Related¶
- Import Collections - Parser Architecture
docs/engine/elements.md- the element registry every mapped kind above targetsdocs/compare/vayu-vs-jmeter.md