Importers
Overview
Six importers convert real-world test artefacts into LoadDensity action JSON or single-task dicts. All of them produce the same task schema so the downstream LD_start_test payload is identical regardless of input format.
Source |
LoadDensity helper |
|---|---|
HAR (browser DevTools, mitmproxy, Charles, …) |
|
Postman v2.1 collection |
|
OpenAPI 3.x (JSON / YAML) |
|
Standalone cURL command |
|
k6 script ( |
|
JMeter JMX plan |
|
cURL
from je_load_density import curl_to_task
task = curl_to_task("""curl -X POST https://api/login \\
-H 'Content-Type: application/json' \\
-d '{"email":"u@x","password":"s"}'""")
Supported flags: -X / --request, -H / --header,
-d / --data / --data-raw / --data-binary / --data-urlencode,
-u / --user (basic auth), -b / --cookie,
-k / --insecure, -L / --location, --compressed.
HAR
from je_load_density import load_har, har_to_action_json
action_json = har_to_action_json(
load_har("recording.har"),
user="fast_http_user",
user_count=20, spawn_rate=10, test_time=120,
include=[r"api\.example\.com"],
exclude=[r"\.svg$"],
)
Status codes from the HAR responses flow through as status_code
assertions on every generated task.
Postman v2.1
from je_load_density import (
load_postman_collection,
postman_to_action_json,
)
action_json = postman_to_action_json(
load_postman_collection("collection.json"),
user="fast_http_user",
user_count=20, spawn_rate=10, test_time=120,
)
Walks folders recursively; raw / urlencoded / formdata bodies are all honoured; disabled headers / fields are skipped.
OpenAPI 3.x
from je_load_density import load_openapi, openapi_to_action_json
action_json = openapi_to_action_json(
load_openapi("openapi.yaml"), # YAML needs [yaml] extra
user="fast_http_user",
user_count=20, spawn_rate=10, test_time=120,
)
Each (path, method) becomes one task; {param} path segments
are rewritten to ${var.param} so the caller supplies values via
register_variables. First 2xx status response becomes a
status_code assertion.
k6
from je_load_density import load_k6_script, k6_script_to_action_json
action_json = k6_script_to_action_json(load_k6_script("script.js"))
Pragmatic parser — matches http.<method>(...) calls and the
adjacent check(res, {...}). Not a full ES module evaluator; meant
for one-shot migrations, not 1:1 round-trips.
JMeter JMX
from je_load_density import load_jmeter_jmx, jmeter_to_action_json
action_json = jmeter_to_action_json(load_jmeter_jmx("plan.jmx"))
Walks the XML, emits one task per HTTPSamplerProxy, inherits
headers from enclosing HeaderManager elements, and converts form
Arguments to either a body string or a dict.
Action JSON commands
Command |
Summary |
|---|---|
|
HAR pipeline. |
|
Postman pipeline. |
|
OpenAPI pipeline. |
|
Parse one cURL command. |
|
k6 script pipeline. |
|
JMeter JMX pipeline. |