Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 48 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,53 @@ jobs:
git commit -m "chore(homebrew): update formulas for ${TAG}"
git push origin "HEAD:${{ github.event.repository.default_branch }}"

integration-test:
name: Integration Test
needs: build
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- name: Install dependencies
run: make deps

- name: Build httprunner
run: make build

- name: Start test services
run: |
docker compose up -d testapi toxiproxy
echo "Waiting for services to be healthy..."
sleep 30
docker ps

- name: Run E2E comprehensive test
run: |
./build/httprunner \
-f tests/e2e/comprehensive-test.http \
-u 2 -i 3 \
-report console -detail summary \
-e <(echo "BASEURL=http://localhost:8080")

- name: Run E2E toxiproxy test
run: |
./build/httprunner \
-f tests/e2e/toxiproxy-demo.http \
-u 1 -i 2 \
-report console -detail summary \
-e <(echo "TOXIPROXY_URL=http://localhost:8081")

- name: Stop test services
if: always()
run: docker compose down -v

docker:
name: Docker Build
needs: test
Expand Down Expand Up @@ -279,7 +326,7 @@ jobs:

semantic_release:
name: Semantic Release
needs: [test, build]
needs: [test, build, integration-test]
runs-on: ubuntu-latest
# Run only when a PR into develop is closed and merged (supports squash/rebase/merge)
if: github.ref == 'refs/heads/develop' && github.event_name == 'push'
Expand Down
8 changes: 4 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- `cmd/httprunner`: CLI to execute .http scenarios and produce reports.
- `cmd/harparser`: HAR → `.http` extractor tool.
- `parser`, `runner`, `reporting`, `metrics`, `http`, `template`: Core Go packages.
- `tests`: End‑to‑end `.http` suites; `examples` contains smaller samples.
- `tests`: All `.http` test files organized into `e2e/`, `unit/`, and `examples/` subdirectories.
- `testapi`, `docker-compose.yml`: Local test services (API + toxiproxy).
- `build/`, `results/` or `reports/`: Build artifacts and test outputs.

Expand All @@ -14,7 +14,7 @@
- `make dev` — fast local build without version ldflags.
- `make test` / `make test-coverage` — run Go unit tests (all packages).
- `make fmt` / `make lint` / `make check` — format, lint (if installed), run tests.
- E2E: `./run-tests.sh` — spins up Docker services and runs `tests/*.http` with reports in `reports/`.
- E2E: `./run-tests.sh` — spins up Docker services and runs `tests/e2e/comprehensive-test.http` with reports in `reports/`.
- Docker: `docker compose up --profile runner httprunner` runs the comprehensive suite defined in compose.

## Coding Style & Naming
Expand All @@ -25,7 +25,7 @@

## Testing Guidelines
- Unit tests: `_test.go`, functions `TestXxx(*testing.T)`. Run with `go test ./...`.
- E2E: author `.http` files under `tests/`. Prefer environment placeholders (e.g., `{{.token}}`) and `.env` files.
- E2E: author `.http` files under `tests/e2e/` or `tests/unit/`. Use `tests/examples/` for documentation. Prefer environment placeholders (e.g., `{{.token}}`) and `.env` files.
- Coverage: keep critical packages (parser, runner, reporting) well covered; run `make test-coverage` locally.

## Commit & PR Guidelines
Expand All @@ -34,5 +34,5 @@
- CI/readiness: ensure `make check` passes and `make build` succeeds; avoid committing generated artifacts in `build/` or `results/`.

## Tips & Utilities
- Run `httprunner -f tests/comprehensive-test.http -u 5 -i 10 -d 50 -report html -output results` locally.
- Run `httprunner -f tests/e2e/comprehensive-test.http -u 5 -i 10 -d 50 -report html -output results` locally.
- Convert recordings: `harparser -f recording.har -filter api/v1 -o requests.http`.
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ if (!baseline) {

#### Complete Metrics Dashboard Example

See `examples/metrics-showcase.http` for a comprehensive example demonstrating:
See `tests/examples/metrics-showcase.http` for a comprehensive example demonstrating:
- Performance baseline establishment
- Load pattern analysis
- Error rate monitoring
Expand Down
16 changes: 8 additions & 8 deletions README-Testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ This will:
docker-compose up --build -d testapi toxiproxy

# Run specific test file
docker-compose run --rm httprunner ./httprunner -u 3 -i 5 -f tests/comprehensive-test.http
docker-compose run --rm httprunner ./httprunner -u 3 -i 5 -f tests/e2e/comprehensive-test.http

# Run with Toxiproxy simulation
docker-compose run --rm httprunner ./httprunner -u 2 -i 3 -f tests/toxiproxy-demo.http
docker-compose run --rm httprunner ./httprunner -u 2 -i 3 -f tests/e2e/toxiproxy-demo.http

# View logs
docker-compose logs testapi
Expand All @@ -93,7 +93,7 @@ docker-compose down -v

## Test Files

### `tests/comprehensive-test.http`
### `tests/e2e/comprehensive-test.http`
Complete test suite demonstrating all HTTP Runner features:
- ✅ Health checks
- ✅ CRUD operations (Users, Products)
Expand Down Expand Up @@ -159,7 +159,7 @@ The included workflow (`.github/workflows/integration-test.yml`) will:
```bash
# High concurrency test
docker-compose run --rm httprunner \
./httprunner -u 50 -i 20 -d 100 -f tests/comprehensive-test.http \
./httprunner -u 50 -i 20 -d 100 -f tests/e2e/comprehensive-test.http \
--html-report reports/load-test.html

# Stress test with Toxiproxy
Expand All @@ -173,7 +173,7 @@ curl -X POST http://localhost:8474/proxies/testapi_proxy/toxics \

# 3. Run tests
docker-compose run --rm httprunner \
./httprunner -u 10 -i 50 -f tests/comprehensive-test.http
./httprunner -u 10 -i 50 -f tests/e2e/comprehensive-test.http
```

### Network Failure Simulation
Expand All @@ -188,11 +188,11 @@ curl -X POST http://localhost:8474/proxies/testapi_proxy/toxics \

### Adding New Endpoints
1. Edit `testapi/main.go` to add new handlers
2. Update `tests/comprehensive-test.http` with new test cases
2. Update `tests/e2e/comprehensive-test.http` with new test cases
3. Rebuild with `docker-compose build testapi`

### Custom Test Scenarios
1. Create new `.http` files in the `tests/` directory
1. Create new `.http` files in the `tests/e2e/` or `tests/unit/` directory
2. Use the same format as existing files
3. Reference environment variables with `{{.VARIABLE_NAME}}`

Expand Down Expand Up @@ -221,7 +221,7 @@ docker-compose restart
```bash
# Run with verbose logging
docker-compose run --rm httprunner \
./httprunner -u 1 -i 1 -f tests/comprehensive-test.http -v
./httprunner -u 1 -i 1 -f tests/e2e/comprehensive-test.http -v

# Check API directly
curl http://localhost:8080/health
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ available on `PATH`; if it is missing or crashes, the CLI falls back to reportin
When the flag is enabled, `httprunner` automatically adds any `node_modules` directories found next
to the `.http` file (and up to two parent directories) to Node's resolution paths. For custom
layouts, you can still extend `NODE_PATH` before launching the runner. See
`examples/external-node-runtime` for a complete walkthrough.
`tests/examples/external-node-runtime` for a complete walkthrough.

### Example requests.http

Expand Down Expand Up @@ -375,7 +375,7 @@ if (!baseline) {

#### Complete Metrics Dashboard Example

See `examples/metrics-showcase.http` for a comprehensive example demonstrating:
See `tests/examples/metrics-showcase.http` for a comprehensive example demonstrating:
- Performance baseline establishment
- Load pattern analysis
- Error rate monitoring
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ services:
command: >
sh -c "
echo 'Starting comprehensive test suite...' &&
./httprunner -u 5 -i 10 -d 50 -f /requests/comprehensive-test.http -output /reports -detail summary -report html &&
./httprunner -u 5 -i 10 -d 50 -f /requests/e2e/comprehensive-test.http -output /reports -detail summary -report html &&
echo 'Test completed. Results saved in reports/'
"
networks:
Expand Down
Loading
Loading