---
title: "Add integration tests"
description: "Ask Autohand Code to add request-level or service-level tests that use the repo harness, fixtures, and validation commands."
seo:
  canonical: "https://autohand.ai/use-cases/add-integration-tests/"
---
Add integration tests with Autohand Code is a verification workflow that adds request-level or service-level coverage around real boundaries, fixtures, persistence, and error behavior.

## At a glance

| Question | Answer |
| --- | --- |
| Best for | API endpoints, service adapters, database-backed flows, auth boundaries, and behavior that unit tests cannot prove alone |
| Primary inputs | The route, command, service method, or user flow to verify; Existing test harness, fixture setup, and local validation commands; Expected success cases, failure cases, auth states, and persistence effects |
| Autohand Code returns | Request-level tests that cover happy paths, failures, and setup data. |
| Avoid when | the target code has no stable boundary or the repo already has equivalent request-level coverage |

## How Autohand Code handles this workflow

1. Finds existing integration-test conventions before adding a new pattern.
2. Builds fixtures and setup through repo helpers instead of ad hoc test data.
3. Covers the main success path, at least one important failure path, and cleanup behavior.
4. Runs the smallest relevant test command and explains any broader suite risk.

## Best inputs

- The route, command, service method, or user flow to verify
- Existing test harness, fixture setup, and local validation commands
- Expected success cases, failure cases, auth states, and persistence effects

## Strong prompt

```bash
autohand -p "Add integration tests for this API flow using the existing test harness"
```

## Autohand Code CLI options

- Run `autohand -p "Add integration tests for this API flow using the existing test harness"` from the service root.
- Use `/plan` first when fixtures, auth, or database setup need sequencing.
- Use `--add-dir <path>` when the endpoint, shared client, and test harness live in sibling packages.

## Review before accepting

Reviewers should see repo-native setup, clear assertions, failure coverage, and a passing focused integration-test command.

## Source and validation signals

Autohand AI maintains this workflow as first-party product guidance for Autohand Code. Use the [Autohand Code CLI Playbook](https://github.com/autohandai/code-cli/blob/main/docs/AUTOHAND_PLAYBOOK.md), [CLI reference](/working-with-autohand-code/cli-reference), and [configuration reference](https://github.com/autohandai/code-cli/blob/main/docs/config-reference.md) when choosing between interactive mode, command mode, auto-mode, feature-enabled /goal, /settings, skills, MCP, and permission settings. The related resources below link to product docs and tutorials for the workflow, and the final answer should name repository-specific files, commands, outputs, or docs that a reviewer can verify.

## Frequently asked questions

**What is Add integration tests with Autohand Code?**

Add integration tests with Autohand Code is a verification workflow that adds request-level or service-level coverage around real boundaries, fixtures, persistence, and error behavior.

**When should a team use Add integration tests?**

Use it when behavior crosses module, process, network, or database boundaries and a unit test would miss the contract.

**What evidence should reviewers check for Add integration tests?**

Reviewers should see repo-native setup, clear assertions, failure coverage, and a passing focused integration-test command.

## Related resources

**[Tutorial: Add Integration Tests to an API](/tutorials/add-integration-tests)**

Verify request behavior, setup data, and failure paths.

**[Tutorial: Scaffold a REST API from Scratch](/tutorials/scaffold-rest-api)**

Pair endpoint implementation with request-level validation.

**[Tutorial: Build a Testing Agent](/agent-sdk/tutorials/600-testing-agent)**

Reuse test-focused agent patterns for integration coverage.
