java.lang.Object
com.agentforge4j.testkit.harness.WorkflowTestHarness
The bootstrap-facing harness adapter: assembles an AgentForge4j runtime with the deterministic
fake LLM provider active, runs a workflow, and returns a
WorkflowRunResult holding the
final state plus the captured event stream and files.
This is the single class in the testkit permitted to depend on agentforge4j.bootstrap;
the assertion and capture layers stay assembly-agnostic. Fake is activated through the only seam
that accepts it — an explicit LlmClientResolver over a FakeLlmClient backed by a
run-agnostic StaticFakeResponseSource, which avoids any pre-start run-id
registration timing problem.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic WorkflowTestHarness.Builderbuilder()Starts a new harness builder.Assembles a fake-backed runtime, runs the given workflow to completion or to its first suspended state, and returns the captured result.run(String workflowId, List<GateResponse> responses) Assembles a fake-backed runtime, starts the given workflow, and drives it forward by draining oneresponseat each human-in-the-loop pause (input / review / step-approval / escalation) until the responses are exhausted.
-
Method Details
-
builder
Starts a new harness builder.- Returns:
- a fresh builder
-
run
Assembles a fake-backed runtime, runs the given workflow to completion or to its first suspended state, and returns the captured result. Equivalent torun(String, List)with no scripted responses — the run is left at its first human-in-the-loop pause.- Parameters:
workflowId- id of a workflow present in the configured fixtures; must not be blank- Returns:
- the run result: final state plus captured events and files
-
run
Assembles a fake-backed runtime, starts the given workflow, and drives it forward by draining oneresponseat each human-in-the-loop pause (input / review / step-approval / escalation) until the responses are exhausted. When the queue is exhausted at a pause, the run is left at that pause so a scenario may assert a meaningful pending state. A response left over after the run has already reached a terminal state is a scripting error — the scenario queued more responses than the run paused for — and fails loudly rather than being silently dropped, symmetric with the pause-mismatch check.- Parameters:
workflowId- id of a workflow present in the configured fixtures; must not be blankresponses- scripted human responses, one consumed per pause in order; must not benull(may be empty)- Returns:
- the run result: the last observed state plus captured events and files
- Throws:
IllegalStateException- if a queued response does not match the pause the run is at, or if the run reaches a terminal state while scripted responses remain unconsumed
-