Testing in Three Layers
Green component tests do not mean a working connector. A MakeApiCall component can pass its test — exit 0, a plausible payload — while ignoring every query parameter and header it is given. Two separate causes produce exactly that:
The Designer's key-value input arrives as a JSON string, and a parser that only accepts an array turns it into
{}without a word.Eventbrite ignores the query string of a GET that carries
Content-Type: application/json.
The test cannot see either: it asks only whether a response came back, and an ignored filter looks like a filter that matched. To catch it, send a filter value that must fail — and expect a 400, not a 200.
A test proves what it asks. appmixer test component asks whether your code runs. Whether the output matches what you promised the Designer, and whether the connector holds up as a flow, are two more questions with two more commands.
The three layers
1 · Component
appmixer test component <dir>
Does my code run against the real API and emit what I expect?
Whether the payload matches the declared schema
2 · Connector
appmixer connector verify <connector>
Does what the API returns match what the manifests promise?
Anything the Designer does — dropdowns, variables, bindings
3 · Flow
appmixer e2e run <flowId>
Does it hold up as a flow on a real instance?
Nothing below it; it needs the connector published (On the Instance)
Each layer's blind spot is the next layer's subject. Layer 1 is the loop you live in while writing components; layers 2 and 3 are gates once it is green.
Layer 1 — component tests
The agent writes a test plan before running anything, and checks authentication first. The plan sets the order — a Create test needs an id a List provides, a Get test needs something a Create made — and says what it will write to your account. Read that part before you say yes: the plan is the one point where the agent reliably asks before writing. Outside it, while exploring an API, it may create records without asking. If writes need your approval, say so at the start.
appmixer test component src/<vendor>/<connector>/core/GetEvent -i '{"in":{"eventId":"..."}}'It takes a directory, not a component type.
-itakes JSON or a file path, and may be repeated. A file path is resolved against the current directory, even an absolute one —/tmp/in.jsonfails withCannot find module.For triggers,
--testruns the component'stest()method and returns a sample at once;-tsets the tick period for a real polling run.Dropdowns cannot be tested here. Their cached source path needs the engine's
staticCache, which the CLI does not provide. Check them in the Designer and in layer 3.
Layer 2 — connector verify
appmixer connector verify runs the behaviour files against the real API and compares each payload, leaf by leaf, with the declared output:
✗declared but absent — the manifest promises a field the API does not send; in the Designer it is a variable that resolves to nothing.~undeclared, or optional and not seen — the API sends a field no flow can reach, or an optional field did not appear.✓— every declared field turned up.
connector validate checks the shape of your source; verify checks its truthfulness.
Undeclared fields are the useful finding. A first verify on a new connector typically lists a dozen fields the API returns and nobody declared — real data no flow can reach. Declare the ones worth having.
✗ on a field you know is optional means the schema never said so. published above is optional — draft events lack it — and GetEvent rightly reports it as ~. Verify can only tell an optional field from a required one when the schema it reads declares required; where nothing does, it treats every leaf as required. That happens with a static schema without required, with an out port declared through options alone, and with a component whose port is built from an outputType input and which exports no ITEM_SCHEMA.
The fix is in your connector, not in the finding: declare required on the schema, and export ITEM_SCHEMA from components with a dynamic out port. Then optional fields come back as ~ and verify can gate CI (Day-to-Day Work).
Fixtures: verify.json
Components that need inputs get them from recipes, never concrete values, so the file works on any account:
Each fixture runs a component and takes a value from the first item it returns. A fixture needs something to find, so an empty account needs one seeded record. Without the file, verify still checks every List, Find and Get component that needs no inputs.
The flags
--write runs the enum round-trip: for each select listed under roundtrip, it creates a record per option and reads the stored value back. It needs:
a
selecton a Create component whose value the service echoes back (a filter on a List or Find does not qualify);a
valueField— the check compares values only when the spec names one, and the label only with alabelField. With neither, it creates a record per option and compares nothing;a
cleanup, which runs for every created record, pass or fail;an account you are willing to have written to.
The result line is fixed text: it says "labels and values match" whatever the spec compared. With a valueField alone — Eventbrite returns a currency code and no name — read it as "values match". A labelField is what catches an inverted label/value map.
--record saves each component's output shape — values replaced by type placeholders — to artifacts/samples/<Component>.json, safe to commit. --offline then re-checks against those samples with no credentials.
Exit code is 0 with no fail or error findings, 1 otherwise.
Layer 3 — the flow
A flow on a real instance is the only test in which the Designer calls your connector the way it does for users — including every dropdown. appmixer e2e import validates every variable the way the Designer does, so it can fail before any flow runs:
That is a dependent dropdown that can never load: Get Event's event dropdown called Find Events without the organization it required, and with a status value it did not accept. Component tests and verify never run a dropdown, so they stayed green. Scope and Research shows how to wire such a dropdown correctly.
The loop
import creates or updates the flows, binds and validates an account, and checks every variable. run starts one flow and watches its logs. results reads the result stores; if it returns {}, trust run's own output.
--fix is a deterministic repair loop: it rebinds the account on a token error and re-runs on a transient failure. When nothing matches, it stops and hands a fix brief to your agent.
0
Passed
1
Failed, or timed out
2
A fix brief was emitted — --fix only
Exit 2 is not a failure. It is a handover — paste it back to the agent. It looks like this (shortened, ids replaced):
That particular fault is in the test, not the connector. Assert turns a boolean field into the string "true" and compares it loosely with what you declared: a JSON true becomes 1, "true" becomes NaN, and the two never match. Write expected booleans as strings. The message reads as nonsense because its operands are printed the wrong way round.
What "done" looks like
Layer 1 says your code runs, layer 2 that your manifests are honest, layer 3 that the connector survives being used. Each catches defects the others pass: dropped parameters, undeclared fields, a dropdown that never loads.
Next: Review Before Publishing.
Last updated
Was this helpful?
