Skip to content
OpenSmartRoute
Skillv1.0.0

testing-strategy

Guidelines for writing effective tests in this project

by block(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from block/agent-skills (testing-strategy/SKILL.md). Install upstream with npx skills add block/agent-skills --skill testing-strategy. Copyright stays with the author.

Testing Guidelines

Unit Tests

  • Test one thing per test
  • Use descriptive test names: test_user_creation_fails_with_invalid_email
  • Mock external dependencies
  • Keep tests fast and isolated

Integration Tests

  • Test API endpoints with realistic data
  • Verify database state changes
  • Clean up test data after each test
  • Use test fixtures for common scenarios

Running Tests

# Run all tests
npm test

# Run unit tests only
npm test:unit

# Run integration tests (requires database)
npm test:integration

# Run tests with coverage
npm test:coverage

Test Structure

tests/
├── unit/           # Fast, isolated unit tests
├── integration/    # Tests requiring external services
├── fixtures/       # Shared test data
└── helpers/        # Test utilities

Best Practices

  1. Arrange-Act-Assert: Structure tests clearly
  2. One assertion per test: When possible, test one behavior
  3. Descriptive names: Test names should describe the scenario
  4. No test interdependence: Tests should run in any order
  5. Clean state: Each test starts with a known state

Coverage Goals

  • Aim for 80%+ line coverage
  • Focus on critical paths first
  • Don't sacrifice test quality for coverage numbers

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/block-agent-skills-testing-strategy/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

block-agent-skills-testing-strategy.ocm.jsonjson
{
  "ocm": "1",
  "id": "block-agent-skills-testing-strategy",
  "kind": "skill",
  "name": "testing-strategy",
  "description": "Guidelines for writing effective tests in this project",
  "publisher": "block",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "coding"
    ],
    "tags": [
      "skill-md",
      "testing",
      "development",
      "quality",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Guidelines for writing effective tests in this project"
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/block/agent-skills",
      "path": "testing-strategy/SKILL.md",
      "ref": "HEAD",
      "url": "https://github.com/block/agent-skills/blob/HEAD/testing-strategy/SKILL.md",
      "key": "block/agent-skills/testing-strategy/SKILL.md"
    }
  },
  "instructions": "# Testing Guidelines\n\n## Unit Tests\n\n- Test one thing per test\n- Use descriptive test names: `test_user_creation_fails_with_invalid_email`\n- Mock external dependencies\n- Keep tests fast and isolated\n\n## Integration Tests\n\n- Test API endpoints with realistic data\n- Verify database state changes\n- Clean up test data after each test\n- Use test fixtures for common scenarios\n\n## Running Tests\n\n```bash\n# Run all tests\nnpm test\n\n# Run unit tests only\nnpm test:unit\n\n# Run integration tests (requires database)\nnpm test:integration\n\n# Run tests with coverage\nnpm test:coverage\n```\n\n## Test Structure\n\n```",
  "cost": {
    "context_tokens": 310
  }
}

Fetch it by URL: GET /api/v1/registry/block-agent-skills-testing-strategy/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.