Managing Development and Testing

1. Setting Up Development Environments

EnvPurpose
localDocker Compose, fast iter
devShared cluster, latest commits
stagingProduction-mirror, pre-release
prodLive traffic
sandboxExternal developer testing

2. Configuring Sandbox Endpoints

FeatureSandbox Behavior
Real backendIsolated test DB
No chargesMock payment processor
Test keyssk_test_*
Lower rate limitsEncourage prod migration
Reset dailyClean state

3. Using Request/Response Mocking

Example: Mock via response-transformer

plugins:
  - name: request-termination
    config:
      status_code: 200
      content_type: application/json
      body: |
        {"id": "mock-123", "status": "pending", "_mock": true}

4. Implementing Test Credentials

TypeConvention
Test API keyssk_test_* prefix
Test card numbers4242424242424242 (Stripe)
Test webhooksHMAC with known secret
Triggered errorsMagic values force failure

5. Setting Up Integration Testing

LayerTool
HTTP APIREST Assured, supertest, httpx
SchemaDredd, Schemathesis
Browser E2EPlaywright, Cypress
ContractPact, OpenAPI diff

6. Using Contract Testing

Example: Pact consumer test

provider.given("user 42 exists")
  .uponReceiving("a request for user 42")
  .withRequest({ method: "GET", path: "/users/42" })
  .willRespondWith({
    status: 200,
    headers: { "Content-Type": "application/json" },
    body: { id: 42, name: like("Ana") }
  });

7. Configuring Load Testing

ToolStrength
k6Scriptable JS, Grafana native
GatlingScala DSL, detailed reports
LocustPython, distributed
VegetaCLI constant-rate
wrkC, max throughput

8. Implementing Security Testing

TestTool
SAST (code)Semgrep, SonarQube, CodeQL
DAST (running)OWASP ZAP, Burp
ContainerTrivy, Grype
DependencySnyk, Dependabot
FuzzingRESTler, Schemathesis

9. Setting Up Continuous Deployment

CD Pipeline

  1. PR opened → run unit + lint
  2. Merge to main → build image, push registry
  3. Deploy to dev → integration tests
  4. Auto-promote to staging → smoke tests
  5. Canary 1% prod → SLO check
  6. Gradual rollout 10% → 50% → 100%
  7. Auto-rollback if error rate spikes

10. Configuring Canary Releases

SettingValue
Initial traffic1%
Step size5-10% per stage
Bake time10-30 min per stage
SLO gateError rate < baseline + 10%
Auto-rollback trigger3 consecutive SLO breach