← All articles
Practical guideWorkflow testing

Keep real-service tests when you add digital twins

Use real dependencies for the behavior only they can establish, and synthetic workflow tests for declared failures and inspectable outcomes.

In this article
Conceptual illustration · AgentTwin journal

Add evidence where your current suite is weak

Your database integration tests may already be doing a good job. They catch invalid queries, schema assumptions and behavior tied to the real engine. Replacing them just to adopt a new tool can remove useful evidence.

The better question is which uncertainty remains. Perhaps you can test a write against the database but cannot reliably recreate the moment an external service saves an action and loses its response.

This guide helps you assign questions to tests. It does not claim that synthetic services reproduce every production behavior.

Reviewed input: Start at one application entry point. Supported operations: Control declared dependency behavior. Observed outcome: Inspect state inside this boundary.
Name what the test exercises. Illustrative test design; this diagram is not a run result.

Give each test a job

Question Useful test boundary
Does this query work with our database engine? Appropriate real database integration test
Do consumer and provider agree on the API? Contract verification where suitable
Does a supported retry leave one business effect? Controlled workflow test with final-state assertions

Some tools can serve more than one job. Choose based on what the test actually exercises rather than the category on its label.

Use synthetic services for explicit behavior

A twin models declared operations and state. That can make a supported failure repeatable and its resulting effects easier to inspect.

AgentTwin currently targets supported Node.js workflows. Its provider operations and fault semantics are bounded. Check the operation reference and runtime status before assuming a dependency is covered.

For example, support for a Stripe customer or payment-intent operation does not mean complete support for subscriptions, refunds or webhook delivery. Keep separate checks for real behaviors that matter outside the modeled subset.

Avoid two tests that hide the same gap

If both tests check only a successful response, neither may notice a duplicate record. Adding a second environment does not fix a missing assertion.

Write the final-state rule first. Then choose the smallest environment that can exercise the relevant behavior. For more examples, read how to write workflow assertions.

Maintain a short list of what each test proves. Include the inputs, dependency boundary and unsupported behavior. Review it when providers or application flows change.

Evaluate the maintenance cost too

Run one important scenario with your current harness and with the proposed addition. Record preparation effort, repeatability and how easily another engineer can explain a failed result.

Do not infer savings from a product demo. A synthetic world that takes more work to maintain than the uncertainty it removes may be the wrong choice for that workflow.

The Testcontainers comparison covers this boundary in more detail. Keep the real-service checks that protect you while evaluating any new layer.

Start with one missing check

Try AgentTwin's sample if you want to inspect the workflow evidence first. For your own application, discuss the missing check, supported operations, preparation and costs before choosing a rollout.

You do not need to replace a successful testing stack to evaluate one useful addition.

Continue readingAgentTwin vs WireMock →
Evaluate one workflow

Can your workflow pass the same check after a failure?

Bring the entry point, dependency operations and result you need to preserve. Discuss whether AgentTwin supports the test, what preparation is needed and the scope and costs before proceeding.

Discuss your workflow Try the sample first →← Back to all articles